From kde-commits Mon Aug 31 21:48:07 2009 From: Martin Koller Date: Mon, 31 Aug 2009 21:48:07 +0000 To: kde-commits Subject: KDE/kdepim/kmail Message-Id: <1251755287.992944.24132.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=125175530324863 SVN commit 1017922 by mkoller: BUG: 196053 Fix crash in precommand execution (hopefully). The crash was probably due to the eventloop object got destroyed in its own loop. M +5 -11 kmaccount.cpp --- trunk/KDE/kdepim/kmail/kmaccount.cpp #1017921:1017922 @@ -395,7 +395,6 @@ SLOT(precommandExited(bool))); kDebug() << "Running precommand" << precommand; - mPrecommandEventLoop = new QEventLoop(); if ( !precommandProcess.start() ) return false; @@ -403,9 +402,10 @@ // the precommand is running (which may take a while). // The exec call will block until the event loop is exited, which happens in // precommandExited(). - if ( mPrecommandEventLoop ) { // yes it can be 0 due to races with precommandProcess.start() - mPrecommandEventLoop->exec(); - } + mPrecommandEventLoop = new QEventLoop(); + mPrecommandEventLoop->exec(); + delete mPrecommandEventLoop; + mPrecommandEventLoop = 0; return mPrecommandSuccess; } @@ -415,16 +415,10 @@ { Q_ASSERT( mPrecommandEventLoop != 0 ); mPrecommandSuccess = success; - - // Exit and delete the event loop. This makes sure the execution continues - // in runPrecommand(), where the event loop was entered. mPrecommandEventLoop->exit(); - - // Use deleteLater, because we are called inside of this very eventloop - mPrecommandEventLoop->deleteLater(); - mPrecommandEventLoop = 0; } +//----------------------------------------------------------------------------- void KMAccount::slotIdentitiesChanged() { // Fall back to the default identity if the one used currently is invalid