summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2011-11-17 14:42:48 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2011-11-17 15:56:31 (GMT)
commit8c898d681d12f3c67e396e7e2f2aa5522288aa63 (patch)
tree3f69e290b76d262df57b1afc691ef312029bf4ca /src/declarative
parent7c5d13df7ec850196a6f9bb739deafbee32c77ee (diff)
downloadQt-8c898d681d12f3c67e396e7e2f2aa5522288aa63.zip
Qt-8c898d681d12f3c67e396e7e2f2aa5522288aa63.tar.gz
Qt-8c898d681d12f3c67e396e7e2f2aa5522288aa63.tar.bz2
DeclarativeDebugServer: Instantiate QPluginLoader on heap
The pluginloader is instantiated on heap with server as its parent so that the connection plugin instance remains loaded in memory. This prevents the plugin loader in QDeclarativeInspectorService to accidentally un-load the plugin while it's in use. Change-Id: I11c82ce595a336ba0fd1b243d23cb497fe355147 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/debugger/qdeclarativedebugserver.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp
index 12691b2..fc908f3 100644
--- a/src/declarative/debugger/qdeclarativedebugserver.cpp
+++ b/src/declarative/debugger/qdeclarativedebugserver.cpp
@@ -95,7 +95,7 @@ public:
private:
// private slot
void _q_deliverMessage(const QString &serviceName, const QByteArray &message);
- static QDeclarativeDebugServerConnection *loadConnectionPlugin(const QString &pluginName);
+ static QDeclarativeDebugServerConnection *loadConnectionPlugin(QPluginLoader *loader, const QString &pluginName);
};
QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() :
@@ -118,7 +118,7 @@ void QDeclarativeDebugServerPrivate::advertisePlugins()
}
QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin(
- const QString &pluginName)
+ QPluginLoader *loader, const QString &pluginName)
{
#ifndef QT_NO_LIBRARY
QStringList pluginCandidates;
@@ -135,17 +135,17 @@ QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectio
}
foreach (const QString &pluginPath, pluginCandidates) {
- QPluginLoader loader(pluginPath);
- if (!loader.load()) {
+ loader->setFileName(pluginPath);
+ if (!loader->load()) {
continue;
}
QDeclarativeDebugServerConnection *connection = 0;
- if (QObject *instance = loader.instance())
+ if (QObject *instance = loader->instance())
connection = qobject_cast<QDeclarativeDebugServerConnection*>(instance);
if (connection)
return connection;
- loader.unload();
+ loader->unload();
}
#endif
return 0;
@@ -200,8 +200,9 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
if (ok) {
server = new QDeclarativeDebugServer();
+ QPluginLoader *loader = new QPluginLoader(server);
QDeclarativeDebugServerConnection *connection
- = QDeclarativeDebugServerPrivate::loadConnectionPlugin(pluginName);
+ = QDeclarativeDebugServerPrivate::loadConnectionPlugin(loader, pluginName);
if (connection) {
server->d_func()->connection = connection;