Debugger: Modified response for "destroyObject" message.
authorSimjees Abraham <simjees.abraham@nokia.com>
Fri, 25 May 2012 07:18:53 +0000 (09:18 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 29 May 2012 10:18:39 +0000 (12:18 +0200)
The response for "destroyObject" carries the debugId of the
destroyed object.

Change-Id: I9be56f8db42ff2e83544ebbd058a6a8d48b4c98f
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>

src/plugins/qmltooling/shared/abstractviewinspector.cpp
src/plugins/qmltooling/shared/abstractviewinspector.h

index c3eb24e..d4c41b5 100644 (file)
 //              "showAppOnTop", "createObject", "destroyObject", "moveObject",
 //              "clearCache"}
 // <DATA> : select: <debugIds_int_list>
-//          reload: <list of relative paths w.r.t project of changed files>
-//                  <list of changed file contents>
+//          reload: <hash<changed_filename_string, filecontents_bytearray>>
 //          setAnimationSpeed: <speed_real>
 //          showAppOnTop: <set_bool>
 //          createObject: <qml_string><parentId_int><imports_string_list><filename_string>
 //          destroyObject: <debugId_int>
 //          moveObject: <debugId_int><newParentId_int>
 //          clearCache: void
+// Response for "destroyObject" carries the <debugId_int> of the destroyed object.
 
 const char REQUEST[] = "request";
 const char RESPONSE[] = "response";
@@ -274,13 +274,13 @@ void AbstractViewInspector::onQmlObjectDestroyed(QObject *object)
     if (!m_hashObjectsTobeDestroyed.contains(object))
         return;
 
-    int removeId = m_hashObjectsTobeDestroyed.take(object);
+    QPair<int, int> ids = m_hashObjectsTobeDestroyed.take(object);
     QQmlDebugService::removeInvalidObjectsFromHash();
 
     QByteArray response;
 
     QQmlDebugStream rs(&response, QIODevice::WriteOnly);
-    rs << QByteArray(RESPONSE) << removeId << true;
+    rs << QByteArray(RESPONSE) << ids.first << true << ids.second;
 
     m_debugService->sendMessage(response);
 }
@@ -346,7 +346,8 @@ void AbstractViewInspector::handleMessage(const QByteArray &message)
             int debugId;
             ds >> debugId;
             if (QObject *obj = QQmlDebugService::objectForId(debugId)) {
-                m_hashObjectsTobeDestroyed.insert(obj, requestId);
+                QPair<int, int> ids(requestId, debugId);
+                m_hashObjectsTobeDestroyed.insert(obj, ids);
                 connect(obj, SIGNAL(destroyed(QObject*)), SLOT(onQmlObjectDestroyed(QObject*)));
                 obj->deleteLater();
             }
index ad42ba7..8eeb640 100644 (file)
@@ -126,8 +126,8 @@ private:
     QList<AbstractTool *> m_tools;
     int m_eventId;
     int m_reloadEventId;
-    // Hash< object to be destroyed, destroy eventId >
-    QHash<QObject *, int> m_hashObjectsTobeDestroyed;
+    // Hash< object to be destroyed, QPair<destroy eventId, object debugId> >
+    QHash<QObject *, QPair<int, int> > m_hashObjectsTobeDestroyed;
 };
 
 } // namespace QmlJSDebugger