From: Kai Koehne Date: Wed, 11 Apr 2012 14:27:14 +0000 (+0200) Subject: Debugger: Add asserts for right usage of threads X-Git-Tag: 071012131707~547 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad615a5a7f2d9060ac043bb7552acebf8fa34550;p=profile%2Fivi%2Fqtdeclarative.git Debugger: Add asserts for right usage of threads Change-Id: I7c377863eb42e693aa4022af33a83098547e0d58 Reviewed-by: Aurindam Jana --- diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp index 3b18f75..25cd18b 100644 --- a/src/qml/debugger/qqmldebugserver.cpp +++ b/src/qml/debugger/qqmldebugserver.cpp @@ -370,6 +370,9 @@ QQmlDebugServer::~QQmlDebugServer() void QQmlDebugServer::receiveMessage(const QByteArray &message) { + // to be executed in debugger thread + Q_ASSERT(QThread::currentThread() == thread()); + Q_D(QQmlDebugServer); QDataStream in(message); @@ -512,6 +515,10 @@ QStringList QQmlDebugServer::serviceNames() const bool QQmlDebugServer::addService(QQmlDebugService *service) { Q_D(QQmlDebugServer); + + // to be executed in GUI thread + Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread()); + { QWriteLocker(&d->pluginsLock); if (!service || d->plugins.contains(service->name())) @@ -532,6 +539,10 @@ bool QQmlDebugServer::addService(QQmlDebugService *service) bool QQmlDebugServer::removeService(QQmlDebugService *service) { Q_D(QQmlDebugServer); + + // to be executed in GUI thread + Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread()); + { QWriteLocker(&d->pluginsLock); QQmlDebugService::State newState = QQmlDebugService::NotConnected; @@ -568,6 +579,9 @@ void QQmlDebugServer::sendMessages(QQmlDebugService *service, bool QQmlDebugServer::waitForMessage(QQmlDebugService *service) { + // to be executed in GUI thread + Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread()); + Q_D(QQmlDebugServer); QReadLocker(&d->pluginsLock);