Commit 9c30f30b authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa
Browse files

Stop crashing on exit when being used solely as a KPart.

This change fixes a crash introduced by commit 3b981ca9 ("Remove Part
from KXMLGUIFactory on exit").

Part::~Part() is the wrong place to call KXMLGUIFactory::removeClient(),
as it assumes addClient() had been called in the first place.

This is only true if Ark is called as a standalone program, since that
is done in MainWindow::loadPart()'s call to KXMLGuiWindow::createGUI().

Conversely, if the Ark KPart is being used as an embedded viewer in,
say, Konqueror or to preview an archive inside an archive (ie. Ark
inside Ark) that does not hold true and we try to access a
KXMLGUIFactory that does not exist.

Instead, call KXMLGuiWindow::removeClient() in MainWindow's destructor,
since in this case we are certain that addClient() was been called

BUG:      341187
FIXED-IN: 14.12
parent 08058f4f
......@@ -38,6 +38,7 @@
#include <KDebug>
#include <KEditToolBar>
#include <KShortcutsDialog>
#include <KXMLGUIFactory>
#include <QDragEnterEvent>
#include <QDragMoveEvent>
......@@ -69,6 +70,8 @@ MainWindow::~MainWindow()
if (m_recentFilesAction) {
m_recentFilesAction->saveEntries(KGlobal::config()->group("Recent Files"));
delete m_part;
m_part = 0;
......@@ -139,8 +139,6 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList& args)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment