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 21 10:03:47 GMT 2013



> On Dec. 21, 2013, 9:42 a.m., Frank Reininghaus wrote:
> > I'll push this change now because it's quite straightforward, and it's the same approach that Konqueror's context menu has been using for ages. I'll also merge upwards, so there's some time left before 4.11.5 tagging to notice any problems with this approach (but I think it's very unlikely that there will be any).

Or maybe I won't. Even though the patch worked nicely when I last tried it, I now get random crashes when killing Dolphin via D-Bus while the context menu is open. This time, it either asserts or segfaults in QGraphicsScene::mousePressEvent() - it seems that this function is not designed for the case that the scene gets deleted from somewhere inside the function.

Opening the context menu in a delayed way might work around this problem. Currently, I can see no other solution.


- Frank


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


On Dec. 14, 2013, 11:06 a.m., Frank Reininghaus wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/114440/
> -----------------------------------------------------------
> 
> (Updated Dec. 14, 2013, 11:06 a.m.)
> 
> 
> 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/20131221/632eb4c2/attachment.htm>


More information about the kfm-devel mailing list