You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by bp...@apache.org on 2016/01/06 09:56:03 UTC

celix git commit: CELIX-312: correct serviceReference usage

Repository: celix
Updated Branches:
  refs/heads/develop 3fa9dba6c -> ffefd303e


CELIX-312: correct serviceReference usage


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/ffefd303
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/ffefd303
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/ffefd303

Branch: refs/heads/develop
Commit: ffefd303ee1daed9e6b012d68017742889ea175e
Parents: 3fa9dba
Author: Bjoern Petri <bp...@apache.org>
Authored: Wed Jan 6 09:55:36 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Wed Jan 6 09:55:36 2016 +0100

----------------------------------------------------------------------
 dependency_manager/private/src/dm_service_dependency.c | 4 ++++
 framework/private/src/service_registry.c               | 4 ++--
 shell_tui/private/src/shell_tui.c                      | 4 ++++
 3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/ffefd303/dependency_manager/private/src/dm_service_dependency.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_service_dependency.c b/dependency_manager/private/src/dm_service_dependency.c
index be865eb..a92bfbf 100644
--- a/dependency_manager/private/src/dm_service_dependency.c
+++ b/dependency_manager/private/src/dm_service_dependency.c
@@ -461,6 +461,10 @@ celix_status_t serviceDependency_invokeSet(dm_service_dependency_pt dependency,
         dependency->set_with_ref(component_getImplementation(dependency->component), curServRef, service);
     }
 
+    if (curServRef) {
+        bundleContext_ungetService(event->context, curServRef, NULL);
+    }
+
     return status;
 }
 

http://git-wip-us.apache.org/repos/asf/celix/blob/ffefd303/framework/private/src/service_registry.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_registry.c b/framework/private/src/service_registry.c
index 10e4293..daa030f 100644
--- a/framework/private/src/service_registry.c
+++ b/framework/private/src/service_registry.c
@@ -443,11 +443,11 @@ celix_status_t serviceRegistry_ungetServiceReference(service_registry_pt registr
         serviceReference_getUsageCount(reference, &count);
         serviceReference_release(reference, &destroyed);
         if (destroyed) {
+
             if (count > 0) {
-                serviceRegistry_logWarningServiceReferenceUsageCount(registry, 0, count);
+                serviceRegistry_logWarningServiceReferenceUsageCount(registry, count, 0);
             }
 
-
             hash_map_pt refsMap = hashMap_get(registry->serviceReferences, bundle);
 
             service_registration_pt reg = NULL;

http://git-wip-us.apache.org/repos/asf/celix/blob/ffefd303/shell_tui/private/src/shell_tui.c
----------------------------------------------------------------------
diff --git a/shell_tui/private/src/shell_tui.c b/shell_tui/private/src/shell_tui.c
index c106ece..e31dff3 100644
--- a/shell_tui/private/src/shell_tui.c
+++ b/shell_tui/private/src/shell_tui.c
@@ -157,6 +157,10 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
 celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
 	celix_status_t status;
 	shell_tui_activator_pt activator = (shell_tui_activator_pt) userData;
+
+	bundleContext_ungetService(activator->context,activator->reference,NULL);
+	bundleContext_ungetServiceReference(activator->context,activator->reference);
+
 	status = bundleContext_removeServiceListener(context, activator->listener);
 
 	if (status == CELIX_SUCCESS) {