aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp36
-rw-r--r--src/qml/debugger/qqmldebugconnector_p.h4
-rw-r--r--src/qml/debugger/qqmldebugservice.cpp4
3 files changed, 22 insertions, 22 deletions
diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
index 91982b415c..1459ab8759 100644
--- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
+++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
@@ -94,8 +94,8 @@ public:
void addEngine(QQmlEngine *engine);
void removeEngine(QQmlEngine *engine);
- bool addService(QQmlDebugService *service);
- bool removeService(QQmlDebugService *service);
+ bool addService(const QString &name, QQmlDebugService *service);
+ bool removeService(const QString &name);
bool open(const QVariantHash &configuration);
void setDevice(QIODevice *socket);
@@ -601,11 +601,14 @@ void QQmlDebugServerImpl::removeEngine(QQmlEngine *engine)
service->engineRemoved(engine);
}
-bool QQmlDebugServerImpl::addService(QQmlDebugService *service)
+bool QQmlDebugServerImpl::addService(const QString &name, QQmlDebugService *service)
{
// to be executed before thread starts
Q_ASSERT(!m_thread);
+ if (!service || m_plugins.contains(name))
+ return false;
+
connect(service, SIGNAL(messageToClient(QString,QByteArray)),
this, SLOT(sendMessage(QString,QByteArray)));
connect(service, SIGNAL(messagesToClient(QString,QList<QByteArray>)),
@@ -616,31 +619,28 @@ bool QQmlDebugServerImpl::addService(QQmlDebugService *service)
connect(service, SIGNAL(detachedFromEngine(QQmlEngine*)),
this, SLOT(wakeEngine(QQmlEngine*)), Qt::QueuedConnection);
+ service->setState(QQmlDebugService::Unavailable);
+ m_plugins.insert(name, service);
- if (!service || m_plugins.contains(service->name()))
- return false;
- m_plugins.insert(service->name(), service);
- QQmlDebugService::State newState = QQmlDebugService::Unavailable;
- if (m_clientPlugins.contains(service->name()))
- newState = QQmlDebugService::Enabled;
- service->setState(newState);
return true;
}
-bool QQmlDebugServerImpl::removeService(QQmlDebugService *service)
+bool QQmlDebugServerImpl::removeService(const QString &name)
{
// to be executed after thread ends
Q_ASSERT(!m_thread);
- QQmlDebugService::State newState = QQmlDebugService::NotConnected;
+ QQmlDebugService *service = m_plugins.value(name);
+ if (!service)
+ return false;
- m_changeServiceStateCalls.ref();
- QMetaObject::invokeMethod(this, "changeServiceState", Qt::QueuedConnection,
- Q_ARG(QString, service->name()),
- Q_ARG(QQmlDebugService::State, newState));
+ m_plugins.remove(name);
+ service->setState(QQmlDebugService::NotConnected);
- if (!service || !m_plugins.contains(service->name()))
- return false;
+ disconnect(service, SIGNAL(detachedFromEngine(QQmlEngine*)),
+ this, SLOT(wakeEngine(QQmlEngine*)));
+ disconnect(service, SIGNAL(attachedToEngine(QQmlEngine*)),
+ this, SLOT(wakeEngine(QQmlEngine*)));
disconnect(service, SIGNAL(messagesToClient(QString,QList<QByteArray>)),
this, SLOT(sendMessages(QString,QList<QByteArray>)));
diff --git a/src/qml/debugger/qqmldebugconnector_p.h b/src/qml/debugger/qqmldebugconnector_p.h
index a4531bf1a9..02e94811a6 100644
--- a/src/qml/debugger/qqmldebugconnector_p.h
+++ b/src/qml/debugger/qqmldebugconnector_p.h
@@ -67,8 +67,8 @@ public:
virtual void addEngine(QQmlEngine *engine) = 0;
virtual void removeEngine(QQmlEngine *engine) = 0;
- virtual bool addService(QQmlDebugService *service) = 0;
- virtual bool removeService(QQmlDebugService *service) = 0;
+ virtual bool addService(const QString &name, QQmlDebugService *service) = 0;
+ virtual bool removeService(const QString &name) = 0;
virtual bool open(const QVariantHash &configuration = QVariantHash()) = 0;
diff --git a/src/qml/debugger/qqmldebugservice.cpp b/src/qml/debugger/qqmldebugservice.cpp
index 3a69799da8..0b07f320ec 100644
--- a/src/qml/debugger/qqmldebugservice.cpp
+++ b/src/qml/debugger/qqmldebugservice.cpp
@@ -72,7 +72,7 @@ QQmlDebugService::QQmlDebugService(const QString &name, float version, QObject *
if (server->service(d->name)) {
qWarning() << "QQmlDebugService: Conflicting plugin name" << d->name;
} else {
- server->addService(this);
+ server->addService(d->name, this);
}
}
@@ -87,7 +87,7 @@ QQmlDebugService::~QQmlDebugService()
if (server->service(d->name) != this)
qWarning() << "QQmlDebugService: Plugin" << d->name << "is not registered.";
else
- server->removeService(this);
+ server->removeService(d->name);
}
const QString &QQmlDebugService::name() const