diff --git a/kdeui/widgets/kmainwindow.cpp b/kdeui/widgets/kmainwindow.cpp index c44aa47..81b8576 100644 --- a/kdeui/widgets/kmainwindow.cpp +++ b/kdeui/widgets/kmainwindow.cpp @@ -224,6 +224,8 @@ KMainWindow::KMainWindow(KMainWindowPrivate &dd, QWidget *parent, Qt::WFlags f) void KMainWindowPrivate::init(KMainWindow *_q) { + KGlobal::ref(); + q = _q; q->setAnimated(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects); @@ -535,13 +537,14 @@ void KMainWindow::closeEvent ( QCloseEvent *e ) // don't call queryExit() twice disconnect(qApp, SIGNAL(aboutToQuit()), this, SLOT(_k_shuttingDown())); d->shuttingDown = true; - KGlobal::deref(); // ...done with this window, the process will quit (unless it's doing something else) } else { // cancel closing, it's stupid to end up with no windows at all.... e->ignore(); } } } else e->ignore(); //if the window should not be closed, don't close it + + KGlobal::deref(); } bool KMainWindow::queryExit()