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

Authored by broulik on Mar 30 2020, 7:55 AM.

Details

Summary

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

Test Plan
  • I get thumbnails in wallpaper dialog again
  • It doesn't spwan multiple preview jobs for the same index anymore.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Mar 30 2020, 7:55 AM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 30 2020, 7:55 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Mar 30 2020, 7:55 AM
davidedmundson accepted this revision.Mar 31 2020, 11:41 AM
This revision is now accepted and ready to land.Mar 31 2020, 11:41 AM
This revision was automatically updated to reflect the committed changes.