celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [37/50] celix git commit: CELIX-351: Fix issue in service_registry incorrectly handling service references when service listeners are removed and some small issue concerning serv ref handling.
Date Mon, 11 Apr 2016 12:00:46 GMT
CELIX-351: Fix issue in service_registry incorrectly handling service references when service
listeners are removed and some small issue concerning serv ref handling.


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

Branch: refs/heads/master
Commit: e0812b00df02655f9e3994c4b48e07f82c434e4a
Parents: b990dde
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Fri Feb 12 14:01:08 2016 +0100
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Fri Feb 12 14:01:08 2016 +0100

----------------------------------------------------------------------
 dependency_manager/private/src/dm_service_dependency.c | 1 +
 framework/private/src/framework.c                      | 6 ++----
 framework/private/src/service_reference.c              | 4 +---
 framework/private/src/service_tracker.c                | 1 +
 4 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/e0812b00/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 11ea28b..4e77175 100644
--- a/dependency_manager/private/src/dm_service_dependency.c
+++ b/dependency_manager/private/src/dm_service_dependency.c
@@ -456,6 +456,7 @@ celix_status_t serviceDependency_invokeSet(dm_service_dependency_pt dependency,
         } else {
             return status;
         }
+
     }
 
     arrayList_destroy(serviceReferences);

http://git-wip-us.apache.org/repos/asf/celix/blob/e0812b00/framework/private/src/framework.c
----------------------------------------------------------------------
diff --git a/framework/private/src/framework.c b/framework/private/src/framework.c
index 56b02cd..6190121 100644
--- a/framework/private/src/framework.c
+++ b/framework/private/src/framework.c
@@ -1454,12 +1454,10 @@ void fw_removeServiceListener(framework_pt framework, bundle_pt bundle,
service_
             int k;
             int rSize = arrayList_size(element->retainedReferences);
             for (k = 0; k < rSize; k += 1) {
-                service_reference_pt ref = arrayList_get(element->retainedReferences,
i);
+                service_reference_pt ref = arrayList_get(element->retainedReferences,
k);
                 if (ref != NULL) {
                     serviceRegistry_ungetServiceReference(framework->registry, element->bundle,
ref); // decrease retain counter                                       
-                } else {
-                    //TODO,FIXME ref is sometimes NULL. This should not happen, investigate
why
-                }
+                } 
             }
 
 			element->bundle = NULL;

http://git-wip-us.apache.org/repos/asf/celix/blob/e0812b00/framework/private/src/service_reference.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_reference.c b/framework/private/src/service_reference.c
index 3f1adff..c40d3c2 100644
--- a/framework/private/src/service_reference.c
+++ b/framework/private/src/service_reference.c
@@ -191,9 +191,7 @@ celix_status_t serviceReference_getOwner(service_reference_pt ref, bundle_pt
*ow
 
 celix_status_t serviceReference_getServiceRegistration(service_reference_pt ref, service_registration_pt
*out) {
     celixThreadRwlock_readLock(&ref->lock);
-    if (ref != NULL) {
-        *out = ref->registration;
-    }
+    *out = ref->registration;
     celixThreadRwlock_unlock(&ref->lock);
     return CELIX_SUCCESS;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/e0812b00/framework/private/src/service_tracker.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_tracker.c b/framework/private/src/service_tracker.c
index 546ee5d..1fb9b37 100644
--- a/framework/private/src/service_tracker.c
+++ b/framework/private/src/service_tracker.c
@@ -132,6 +132,7 @@ celix_status_t serviceTracker_open(service_tracker_pt tracker) {
 			for (i = 0; i < arrayList_size(initial); i++) {
 				initial_reference = (service_reference_pt) arrayList_get(initial, i);
 				serviceTracker_track(tracker, initial_reference, NULL);
+                bundleContext_ungetServiceReference(tracker->context, initial_reference);
 			}
 			arrayList_clear(initial);
 			arrayList_destroy(initial);


Mime
View raw message