Information Panel: fix race condition (caused by multiple running PreviewJobs)

Review Request #114561 - Created Dec. 20, 2013 and submitted

Information
Frank Reininghaus
kde-baseapps
KDE/4.12
250787
Reviewers
dolphin
In

InformationPanelContent::showItem(const KFileItem& item) 

or

InformationPanelContent::showItems(const KFileItemList& items),

we either load an icon in the panel, or we start a PreviewJob to get a preview for the current item. However, if a long-running PreviewJob is active already, we load the preview that it creates later on, even though the preview might be for an item that is not hovered any more.

To fix this, we can keep a pointer to the last preview job, and kill it before a new item is being shown in the panel, or a new preview job is started.
I couldn't really test it yet because my development user does not have the PDF thumbnailer (yet), and previews for other files are generated so fast here that it's hard to see the race. But I verified that the panel still works as expected when hovering items.

Issues

  • 1
  • 0
  • 0
  • 1
Description From Last Updated
m_pendingPreview makes no sense anymore with this patch, so we can safely remove it I think. Emmanuel Pescosta Emmanuel Pescosta
Emmanuel Pescosta
Emmanuel Pescosta
Frank Reininghaus
Emmanuel Pescosta
Commit Hook
This review has been submitted with commit 8ed499f28fa2954c9b7c5fe0624d5b2b2b5c8630 by Frank Reininghaus to branch KDE/4.12.
Frank Reininghaus
Review request changed

Status: Closed (submitted)

Loading...