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 before. BUG: 341187 FIXED-IN: 14.12
Showing with 3 additions and 2 deletions