D21755: Replace ToolAction by a more universal “ToggleActionMenu”

David Hurka noreply at phabricator.kde.org
Sun Jun 16 18:22:37 BST 2019


davidhurka added a comment.


  I couldn’t find a reason why disconnecting my slot at destruction fails, but it indeed fails.
  
  Workarround is to use the simpler way: QPointer. (ToolAction already does it that way.)

INLINE COMMENTS

> davidhurka wrote in toggleactionmenu.cpp:63
> That’s what puzzles me.
> 
> It doesn’t always crash (only 5–10% of times closing Okular). If you add qDebug()s to the functions, you see the destructor beeing called before forgetButton() is called. (Assuming `~ToggleActionMenu() override` is added.) Valgrind confirms that (just run `valgrind okular` and close the window), and complains that forgetButton() is called on an already deleted object. (Invalid read of size 4 in QSet::isEmpty().)
> 
> I hope that I misinterpret something.

1. ~PageView() calls ~ToggleActionMenu(), because it’s a child.
2. ~WidgetAction() (probably called trough some XMLGui stuff) calls ~QToolButton to delete the toolbar buttons.
3. ~QToolButton() emits destroyed(), which triggers the ToggleActionMenu, //although// this was already destroyed.
4. forgetButton() accesses deallocated space (`this->m_buttons`), possibly causing a segfault.

My only idea why ~QObject() fails to disconnect ToggleActionMenu:
It all happens in another destructor (but not in a base class destructor; in that case this behaviour would be officially documented).

REPOSITORY
  R223 Okular

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

To: davidhurka, #okular
Cc: aacid, #vdg, okular-devel, fbampaloukas, joaonetto, tfella, ngraham, darcyshen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20190616/84deade0/attachment.html>


More information about the Okular-devel mailing list