summaryrefslogtreecommitdiff
path: root/libresourceqt/src/resource-engine.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-08-03 15:55:54 +0300
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-08-03 15:55:54 +0300
commit223a40ec162252785591c2164f3ca1326d7878ea (patch)
treeab639453bb345a13f4b4cea054ed2f2205498b82 /libresourceqt/src/resource-engine.cpp
parent4689a740a3b9777aaeb644472d722a42240b6fa6 (diff)
downloadlibresourceqt-223a40ec162252785591c2164f3ca1326d7878ea.tar.gz
Fixed bug NB#181713
Diffstat (limited to 'libresourceqt/src/resource-engine.cpp')
-rw-r--r--libresourceqt/src/resource-engine.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/libresourceqt/src/resource-engine.cpp b/libresourceqt/src/resource-engine.cpp
index e4068d2..dae826b 100644
--- a/libresourceqt/src/resource-engine.cpp
+++ b/libresourceqt/src/resource-engine.cpp
@@ -3,6 +3,8 @@
using namespace ResourcePolicy;
+static QMultiMap<resconn_t *, ResourceEngine *> engineMap;
+
resconn_t *ResourceEngine::libresourceConnection = NULL;
quint32 ResourceEngine::libresourceUsers = 0;
@@ -88,9 +90,11 @@ bool ResourceEngine::initialize()
resproto_set_handler(ResourceEngine::libresourceConnection, RESMSG_UNREGISTER, handleUnregisterMessage);
resproto_set_handler(ResourceEngine::libresourceConnection, RESMSG_GRANT, handleGrantMessage);
resproto_set_handler(ResourceEngine::libresourceConnection, RESMSG_ADVICE, handleAdviceMessage);
+ engineMap.insert(ResourceEngine::libresourceConnection, this);
}
else {
ResourceEngine::libresourceUsers += 1;
+ engineMap.insert(ResourceEngine::libresourceConnection, this);
}
qDebug("ResourceEngine (%u, %p) is now initialized. %d users",
@@ -277,7 +281,7 @@ bool ResourceEngine::disconnectFromManager()
bool ret = true;
if (libresourceSet != NULL) {
- ret = resconn_disconnect(libresourceSet, &resourceMessage, statusCallbackHandler) != 0;
+ ret = resconn_disconnect(libresourceSet, &resourceMessage, statusCallbackHandler)?true:false;
}
return ret;
}
@@ -561,15 +565,14 @@ static void connectionIsUp(resconn_t *connection)
{
qDebug("**************** %s() - locking....", __FUNCTION__);
QMutexLocker locker(&mutex);
- if (NULL == connection->dbus.rsets->userdata) {
- qDebug("IGNORING connectionIsUp");
- return;
- }
- ResourceEngine *resourceEngine;
- resourceEngine = reinterpret_cast<ResourceEngine *>(connection->dbus.rsets->userdata);
qDebug("connection is up");
- resourceEngine->handleConnectionIsUp(connection);
+
+ QList<ResourceEngine*> engines = engineMap.values(connection);
+ for (int i = 0; i < engines.size(); ++i) {
+ ResourceEngine *resourceEngine = engines.at(i);
+ resourceEngine->handleConnectionIsUp(connection);
+ }
}
void ResourceEngine::handleConnectionIsUp(resconn_t *connection)