V8Debugging: Set Isolate when sending debug messages to v8
authorAurindam Jana <aurindam.jana@digia.com>
Tue, 23 Apr 2013 11:44:41 +0000 (13:44 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 23 Apr 2013 12:15:17 +0000 (14:15 +0200)
Pass the Isolate used for setting the DebugMessageDispatchHandler
to SendDebugMessage. This is to ensure that the proper dispatch
handler is called since the Debugger is per Isolate.

Change-Id: I4497155b90d4b678a5c4116859269892441ce70e
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
src/qml/debugger/qv8debugservice.cpp

index f41907a..9045b4b 100644 (file)
@@ -107,7 +107,8 @@ class QV8DebugServicePrivate : public QQmlDebugServicePrivate
 {
 public:
     QV8DebugServicePrivate()
-        : engine(0)
+        : engine(0),
+          debugIsolate(0)
     {
     }
 
@@ -119,6 +120,7 @@ public:
     QWaitCondition initializeCondition;
     QStringList breakOnSignals;
     const QV8Engine *engine;
+    v8::Isolate *debugIsolate;
 };
 
 QV8DebugService::QV8DebugService(QObject *parent)
@@ -186,6 +188,9 @@ void QV8DebugService::signalEmitted(const QString &signal)
 // executed in the gui thread
 void QV8DebugService::init()
 {
+    Q_D(QV8DebugService);
+    if (!d->debugIsolate)
+        d->debugIsolate = v8::Isolate::GetCurrent();
     v8::Debug::SetMessageHandler2(DebugMessageHandler);
     v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler);
     QV4Compiler::enableV4(false);
@@ -267,7 +272,8 @@ void QV8DebugService::messageReceived(const QByteArray &message)
 
 void QV8DebugService::sendDebugMessage(const QString &message)
 {
-    v8::Debug::SendCommand(message.utf16(), message.size());
+    Q_D(QV8DebugService);
+    v8::Debug::SendCommand(message.utf16(), message.size(), 0, d->debugIsolate);
 }
 
 void QV8DebugService::processDebugMessages()