Merged revisions 837905 via svnmerge from

svn+ssh://tmcguire@svn.kde.org/home/kde/branches/KDE/4.1/kdepim

........
  r837905 | tmcguire | 2008-07-26 01:52:04 +0200 (Sat, 26 Jul 2008) | 10 lines
  
  Backport r837489 by tmcguire to the 4.1 branch:
  
  Don't delete the precommand event loop from within itself.
  Event loops are Evil.
  
  This should fix precommands yet again (I hope).
  
  CCBUG: 165453
........

svn path=/branches/kdepim/enterprise4/kdepim/; revision=837996
wilder-work
Thomas McGuire 18 years ago
parent dfd0b77359
commit 72e4540b0d
  1. 12
      kmaccount.cpp

@ -384,7 +384,8 @@ bool KMAccount::runPrecommand(const QString &precommand)
connect(&precommandProcess, SIGNAL(finished(bool)),
SLOT(precommandExited(bool)));
kDebug(5006) <<"Running precommand" << precommand;
kDebug(5006) << "Running precommand" << precommand;
mPrecommandEventLoop = new QEventLoop();
if ( !precommandProcess.start() )
return false;
@ -392,8 +393,9 @@ bool KMAccount::runPrecommand(const QString &precommand)
// the precommand is running (which may take a while).
// The exec call will block until the event loop is exited, which happens in
// precommandExited().
mPrecommandEventLoop = new QEventLoop();
mPrecommandEventLoop->exec();
if ( mPrecommandEventLoop ) { // yes it can be 0 due to races with precommandProcess.start()
mPrecommandEventLoop->exec();
}
return mPrecommandSuccess;
}
@ -407,7 +409,9 @@ void KMAccount::precommandExited(bool success)
// Exit and delete the event loop. This makes sure the execution continues
// in runPrecommand(), where the event loop was entered.
mPrecommandEventLoop->exit();
delete mPrecommandEventLoop;
// Use deleteLater, because we are called inside of this very eventloop
mPrecommandEventLoop->deleteLater();
mPrecommandEventLoop = 0;
}

Loading…
Cancel
Save