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

Kai Uwe Broulik noreply at phabricator.kde.org
Mon Mar 30 08:55:33 BST 2020


broulik created this revision.
broulik added reviewers: Plasma, leinir, davidre.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
broulik requested review of this revision.

REVISION 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.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D28420

AFFECTED FILES
  wallpapers/image/backgroundlistmodel.cpp
  wallpapers/image/backgroundlistmodel.h

To: broulik, #plasma, leinir, davidre
Cc: plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200330/356721e7/attachment.html>


More information about the Plasma-devel mailing list