Review Request 113714: Call KXMLGUIFactory::reset() before we start building the UI in createGUI()

Dan Vrátil dvratil at redhat.com
Thu Nov 7 19:52:25 GMT 2013


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

Review request for kdelibs.


Repository: kdelibs


Description
-------

Call KXMLGUIFactory::reset() before calling KXMLGUIFactory::addClient(this) in KXMLGuiWindow::createGUI(), otherwise a crash can occur:

createGUI() calls qDeleteAll(toolbars()) before it starts building the GUI, which can leave KXMLGUIFactory::Private::m_rootNode with ContainerNodes internally pointing to, now an invalid, pointer to KToolBar(s). This won't obviously happen when createGUI() is only called once (which is what most apps do), but it can happen when it is called multiple times (reinstalling UI on tab change for example). Leaving m_rootNode with invalid ContainerNodes causes KXMLGUIBuilder to crash, because it tries to add items into an invalid KToolBar.

Calling KXMLGUIFactory::reset() first will make sure the m_rootNode is purged, all invalid pointers are removed and KXMLGUIBuilder instantiates a new KToolBar before inserting items.


Diffs
-----

  kdeui/xmlgui/kxmlguiwindow.cpp aa4a067 

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


Testing
-------


Thanks,

Dan Vrátil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20131107/5bd2fc1d/attachment.htm>


More information about the kde-core-devel mailing list