summaryrefslogtreecommitdiff
path: root/libresourceqt/src/resource-engine.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-04-21 16:03:03 +0300
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-04-21 16:14:01 +0300
commit3a5be2e8aff1c1bdd6406904307a7b3b7a062d38 (patch)
treec31a83baf98e753675bcdc1f67b739f1bdae5896 /libresourceqt/src/resource-engine.cpp
parent118f1cc0392785bd0f8b31cbcd624885eebe4fcb (diff)
downloadlibresourceqt-3a5be2e8aff1c1bdd6406904307a7b3b7a062d38.tar.gz
Fixed destructor
Diffstat (limited to 'libresourceqt/src/resource-engine.cpp')
-rw-r--r--libresourceqt/src/resource-engine.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/libresourceqt/src/resource-engine.cpp b/libresourceqt/src/resource-engine.cpp
index 929db17..93df853 100644
--- a/libresourceqt/src/resource-engine.cpp
+++ b/libresourceqt/src/resource-engine.cpp
@@ -4,6 +4,7 @@
using namespace ResourcePolicy;
resconn_t *ResourceEngine::libresourceConnection = NULL;
+quint32 ResourceEngine::libresourceUsers = 0;
static inline quint32 allResourcesToBitmask(const ResourceSet *resourceSet);
static inline quint32 optionalResourcesToBitmask(const ResourceSet *resourceSet);
@@ -29,8 +30,10 @@ ResourceEngine::ResourceEngine(ResourceSet *resourceSet)
ResourceEngine::~ResourceEngine()
{
- if (libresourceSet != NULL)
+ libresourceUsers--;
+ if (libresourceUsers == 0) {
libresourceSet->userdata = NULL;
+ }
//need to destroy all libresource structures, but how?
}
@@ -56,10 +59,14 @@ bool ResourceEngine::initialize()
if (ResourceEngine::libresourceConnection == NULL) {
return NULL;
}
+ ResourceEngine::libresourceUsers = 1;
resproto_set_handler(ResourceEngine::libresourceConnection, RESMSG_UNREGISTER, handleUnregisterMessage);
resproto_set_handler(ResourceEngine::libresourceConnection, RESMSG_GRANT, handleGrantMessage);
resproto_set_handler(ResourceEngine::libresourceConnection, RESMSG_ADVICE, handleAdviceMessage);
}
+ else {
+ ResourceEngine::libresourceUsers += 1;
+ }
qDebug("ResourceEngine (%p) is now initialized.", this);
return true;