From f74aa1e9a6cf8cf827e4df0eebbe396d7fc5a490 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Thu, 4 Apr 2013 17:14:38 +0200 Subject: [PATCH] terminate if more than one thread is being started. --- src/mirall/csyncthread.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp index bc48bf40ab..915c3ef845 100644 --- a/src/mirall/csyncthread.cpp +++ b/src/mirall/csyncthread.cpp @@ -26,6 +26,8 @@ #include #endif +#include + #include #include #include @@ -323,6 +325,12 @@ void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) { void CSyncThread::startSync() { + qDebug() << Q_FUNC_INFO << "Sync started"; + + static int syncsRunning = 0; + syncsRunning++; + assert(syncsRunning == 1); + qDebug() << "starting to sync " << qApp->thread() << QThread::currentThread(); CSYNC *csync; int proxyPort = _proxy.port(); @@ -414,6 +422,8 @@ void CSyncThread::startSync() emit treeWalkResult(_syncedItems); } } + syncsRunning--; + qDebug() << Q_FUNC_INFO << "Sync finished"; } void CSyncThread::setConnectionDetails( const QString &user, const QString &passwd, const QNetworkProxy &proxy )