Skip to content
Commit 49230140 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Image Wallpaper] Fix thumbnail generation when model is reloaded in-flight

GHNS Quick Button signals changedEntriesChanged initially even if nothing changed.
While this is a bug that should be fixed in GHNS, the wallpaper model didn't handle the case well,
when the model was reloaded while a preview was being generated.

It looks up whether a preview exists by QUrl and stores a QPersistentModelIndex.
However, when the model is reloaded and it accesses data for the same QUrl, the job might still be in-flight,
but the QPersistentModelIndex is invalid as the model has been reset.

This fixes it by performing all lookups exclusively on QPersistentModelIndex.
The hash lookup is optimized for data() (loads of accesses) with the slower key() lookup being done only
when the less frequently occurring thumbnail generation finishes/fails.
It will now do two preview jobs initially, but at least it shows something again...

BUG: 419234
FIXED-IN: 5.18.4

Differential Revision: https://phabricator.kde.org/D28420
parent 2caf4d0b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment