# # # patch "src/monotone/MonotoneThread.cpp" # from [acb95329b00c825ddbc7f61709dce7805cf87cd1] # to [c15b3807460064117d7d5904624decb5f0f52759] # # patch "src/monotone/MonotoneThread.h" # from [dd3abaa03d5a86ab9141e3da15c0e62766e016aa] # to [0069c37d917b91a7f98879968923aa36fef8c158] # ============================================================ --- src/monotone/MonotoneThread.cpp acb95329b00c825ddbc7f61709dce7805cf87cd1 +++ src/monotone/MonotoneThread.cpp c15b3807460064117d7d5904624decb5f0f52759 @@ -22,6 +22,7 @@ #include #include +#include MonotoneTask::MonotoneTask() { @@ -147,7 +148,12 @@ MonotoneThread::MonotoneThread( int thread, const QString & m, const QString & d, const QString & w ) : QThread(), doAbort(false), commandNumber(0), threadNumber(thread), mtnBinary(m), databasePath(d), workspacePath(w) -{} +{ + connect( + this, SIGNAL(aborted(int, QProcess::ProcessError, const QString &)), + this, SLOT(cleanup()) + ); +} MonotoneThread::~MonotoneThread() {} @@ -212,8 +218,6 @@ void MonotoneThread::run() "workspace, which may lead to serious path resolution " "errors on execution. Its recommended you remove " "this workspace before you retry this again!").arg(tmpPath)); - - cleanup(process); return; } process->setWorkingDirectory(tmpPath); @@ -235,7 +239,6 @@ void MonotoneThread::run() emit aborted(threadNumber, process->error(), QString::fromUtf8(process->readAllStandardError()) ); - cleanup(process); return; } @@ -252,7 +255,6 @@ void MonotoneThread::run() QString err = QString::fromUtf8(process->readAllStandardError()); emit aborted(threadNumber, process->error(), err); - cleanup(process); return; } process->setReadChannel(QProcess::StandardOutput); @@ -283,7 +285,6 @@ void MonotoneThread::run() emit aborted(threadNumber, process->error(), QString::fromUtf8(process->readAllStandardError()) ); - cleanup(process); return; } @@ -334,7 +335,6 @@ void MonotoneThread::run() emit aborted(threadNumber, process->error(), QString::fromUtf8(process->readAllStandardError()) ); - cleanup(process); return; } @@ -431,3 +431,17 @@ void MonotoneThread::abort() waitForTasks.wakeAll(); } +bool MonotoneThread::waitForStarted() +{ + QEventLoop * ev = new QEventLoop(this); + + connect(this, SIGNAL(started(int)), + ev, SLOT(quit())); + connect(this, SIGNAL(aborted(int, QProcess::ProcessError, const QString &)), + ev, SLOT(quit())); + + ev->exec(); + + delete ev; + return !doAbort; +} ============================================================ --- src/monotone/MonotoneThread.h dd3abaa03d5a86ab9141e3da15c0e62766e016aa +++ src/monotone/MonotoneThread.h 0069c37d917b91a7f98879968923aa36fef8c158 @@ -138,6 +138,9 @@ public: */ void abort(); + //! wait until the underlying mtn process is up and running + bool waitForStarted(); + protected: void run();