diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-02-05 17:00:51 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-05 18:42:42 +0100 |
commit | 1845ae01929cdaf6aa50ae096fe5c249f14b1f18 (patch) | |
tree | 4efe92ed5512cbe64bddaba8549498367d904e16 /src/qml | |
parent | 9ca736fd3f77aff2bbc61f6deabe2dc44f6e1bfd (diff) |
Prevent concurrent access to v4 debugger
Without this new engines can be added to the QV4DebugService while
breakpoints are set from the debugger thread. In rare cases this leads
to a situation where the DebuggerAgent::addDebugger() doesn't see the
new breakpoint and DebuggerAgent::addBreakPoint() doesn't see the new
debugger. Thus the breakpoint will never be set.
This effect is easily reproducible by repeatedly (about 100 times)
running the setBreakpointInScriptOnTimerCallback autotest.
Change-Id: I5da27478bf579ab24f81aebabbdd321f38fae3f4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/debugger/qv4debugservice.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/debugger/qv4debugservice.cpp b/src/qml/debugger/qv4debugservice.cpp index 52fbbcf0f0..0058e78e7f 100644 --- a/src/qml/debugger/qv4debugservice.cpp +++ b/src/qml/debugger/qv4debugservice.cpp @@ -1025,7 +1025,7 @@ QV4DebugService *QV4DebugService::instance() void QV4DebugService::engineAboutToBeAdded(QQmlEngine *engine) { Q_D(QV4DebugService); - + QMutexLocker lock(&d->initializeMutex); if (engine) { QV4::ExecutionEngine *ee = QV8Engine::getV4(engine->handle()); if (QQmlDebugServer *server = QQmlDebugServer::instance()) { @@ -1044,6 +1044,7 @@ void QV4DebugService::engineAboutToBeAdded(QQmlEngine *engine) void QV4DebugService::engineAboutToBeRemoved(QQmlEngine *engine) { Q_D(QV4DebugService); + QMutexLocker lock(&d->initializeMutex); if (engine){ const QV4::ExecutionEngine *ee = QV8Engine::getV4(engine->handle()); if (ee) { |