D5821: KViewStateSerializer: Fix crash when view is destroyed before state serializer

Christoph Feck noreply at phabricator.kde.org
Fri May 12 02:13:08 UTC 2017


cfeck created this revision.
cfeck added a project: Frameworks.

REVISION SUMMARY
  According to bug 353380, KViewStateSerializer::restoreScrollBarState() calls QScrollBar::maximum() on an invalid (i.e. already deleted) scrollbar. This means, the enclosing QAbstractScrollArea has been deleted between the call to ::restoreScrollState() and the deferred (via a single shot timer) ::restoreScrollBarState().
  
  This bug had already been reported against the kdelibs4 KViewStateSaver as bug 328755. The commit there (comment #9) was not forward-ported to KWidgetsAddons, but also was not effective, evidenced by the more recent comments.
  
  The actual cause (i.e. the view is destroyed before the state saver) could probably also be fixed in the calling code, but according to LXR, there are many users of ETMViewStateSaver, and I got confused about the comment at https://lxr.kde.org/source/kde/pim/korganizer/src/akonadicollectionview.cpp#022
  
  This commit works around the issue by allowing users to delete the view immediately after ::restoreScrollState() was called.

REPOSITORY
  R236 KWidgetsAddons

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

AFFECTED FILES
  src/kviewstateserializer.cpp

To: cfeck, #frameworks
Cc: mlaurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170512/a0b34eeb/attachment.html>


More information about the Kde-frameworks-devel mailing list