Review Request 114440: Fix crash if the main window is deleted inside the nested event loop of the context menu

Frank Reininghaus frank78ac at googlemail.com
Sat Dec 14 11:06:35 GMT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/114440/
-----------------------------------------------------------

Review request for Dolphin.


Bugs: 259089
    http://bugs.kde.org/show_bug.cgi?id=259089


Repository: kde-baseapps


Description
-------

We get a crash if the main window is deleted while the nested event loop of the context menu is running. The reason is that the KFileItemActions instance is currently a local variable inside a member function of the context menu. After returning from the event loop, the context menu (child of the main window) is deleted, and calling the destructor of KFileItemActions causes trouble.

This can be reproduced by (provided that only one Dolphin window is open)

sleep 5; qdbus `qdbus | grep dolphin` /dolphin/Dolphin_1/actions/file_quit trigger

and then opening the context menu in Dolphin.

The easiest solution seems to be that we make sure that KFileItemActions is destroyed at the same time as the menu, by making it a member of the context menu, rather than a local variable. This is also how it's done in Konqueor's KonqPopupMenu.

I tried to keep the diff as small as possible for the KDE/4.11 branch. There might be some potential for simplifications, but these should better be done in master.


Diffs
-----

  dolphin/src/dolphincontextmenu.h 180f917 
  dolphin/src/dolphincontextmenu.cpp f4b4698 

Diff: http://git.reviewboard.kde.org/r/114440/diff/


Testing
-------

Fixes the crash for me. Context menu still sees to work OK.


Thanks,

Frank Reininghaus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20131214/cf083bef/attachment.htm>


More information about the kfm-devel mailing list