QDeclarativeDebugService: Crash fix
authorAurindam Jana <aurindam.jana@nokia.com>
Thu, 24 Nov 2011 12:14:21 +0000 (13:14 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 24 Nov 2011 14:02:58 +0000 (15:02 +0100)
Query for serviceNames in registerService.

Change-Id: I570bd68c424cec696ca813a7fa1b485b64e328a4
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
src/declarative/debugger/qdeclarativedebugservice.cpp

index 0a997aa..2bdcf2f 100644 (file)
@@ -61,10 +61,7 @@ QDeclarativeDebugService::QDeclarativeDebugService(const QString &name, QObject
     d->server = QDeclarativeDebugServer::instance();
     d->status = QDeclarativeDebugService::NotConnected;
 
-    if (d->server->serviceNames().contains(d->name)) {
-        qWarning() << "QDeclarativeDebugService: Conflicting plugin name" << d->name;
-        d->server = 0;
-    }
+
 }
 
 QDeclarativeDebugService::QDeclarativeDebugService(QDeclarativeDebugServicePrivate &dd,
@@ -87,7 +84,12 @@ QDeclarativeDebugService::Status QDeclarativeDebugService::registerService()
     if (!d->server)
         return NotConnected;
 
-    d->server->addService(this);
+    if (d->server->serviceNames().contains(d->name)) {
+        qWarning() << "QDeclarativeDebugService: Conflicting plugin name" << d->name;
+        d->server = 0;
+    } else {
+        d->server->addService(this);
+    }
     return status();
 }