celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject celix git commit: CELIX-351: Moved remove service listener after untracking service in service tracker. This ensure service reference are still valid during untracking.
Date Fri, 12 Feb 2016 08:33:54 GMT
Repository: celix
Updated Branches:
  refs/heads/develop 94348219b -> b990dde04


CELIX-351: Moved remove service listener after untracking service in service tracker. This
ensure service reference are still valid during untracking.


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

Branch: refs/heads/develop
Commit: b990dde04edd5a106a8e39bf57158167177c267d
Parents: 9434821
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Fri Feb 12 09:32:57 2016 +0100
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Fri Feb 12 09:32:57 2016 +0100

----------------------------------------------------------------------
 cmake/CMakeCelix.cmake                    | 1 +
 cmake/cmake_celix/BuildOptions.cmake      | 7 +++++++
 framework/private/src/service_reference.c | 4 +++-
 framework/private/src/service_tracker.c   | 4 +++-
 4 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/b990dde0/cmake/CMakeCelix.cmake
----------------------------------------------------------------------
diff --git a/cmake/CMakeCelix.cmake b/cmake/CMakeCelix.cmake
index 2bff25b..0cda030 100644
--- a/cmake/CMakeCelix.cmake
+++ b/cmake/CMakeCelix.cmake
@@ -31,3 +31,4 @@ include(cmake_celix/PackagingLegacy)
 #include(cmake_celix/Test)
 include(cmake_celix/ApacheRat)
 include(cmake_celix/CodeCoverage)
+include(cmake_celix/BuildOptions)

http://git-wip-us.apache.org/repos/asf/celix/blob/b990dde0/cmake/cmake_celix/BuildOptions.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/BuildOptions.cmake b/cmake/cmake_celix/BuildOptions.cmake
new file mode 100644
index 0000000..8c5caf5
--- /dev/null
+++ b/cmake/cmake_celix/BuildOptions.cmake
@@ -0,0 +1,7 @@
+
+option(ENABLE_ADDRESS_SANITIZER "Enabled building with address sanitizer. Note for gcc libasan
must be installed" OFF)
+
+if (ENABLE_ADDRESS_SANITIZER)
+    set(CMAKE_C_FLAGS "-lasan -fsanitize=address ${CMAKE_C_FLAGS}")
+    set(CMAKE_CXX_FLAGS "-lasan -fsanitize=address ${CMAKE_CXX_FLAGS}")
+endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/b990dde0/framework/private/src/service_reference.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_reference.c b/framework/private/src/service_reference.c
index c40d3c2..3f1adff 100644
--- a/framework/private/src/service_reference.c
+++ b/framework/private/src/service_reference.c
@@ -191,7 +191,9 @@ 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);
-    *out = ref->registration;
+    if (ref != NULL) {
+        *out = ref->registration;
+    }
     celixThreadRwlock_unlock(&ref->lock);
     return CELIX_SUCCESS;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/b990dde0/framework/private/src/service_tracker.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_tracker.c b/framework/private/src/service_tracker.c
index 92c3a92..546ee5d 100644
--- a/framework/private/src/service_tracker.c
+++ b/framework/private/src/service_tracker.c
@@ -148,7 +148,6 @@ celix_status_t serviceTracker_open(service_tracker_pt tracker) {
 celix_status_t serviceTracker_close(service_tracker_pt tracker) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	status = bundleContext_removeServiceListener(tracker->context, tracker->listener);
 	if (status == CELIX_SUCCESS) {
 		array_list_pt refs = serviceTracker_getServiceReferences(tracker);
 		if (refs != NULL) {
@@ -160,6 +159,9 @@ celix_status_t serviceTracker_close(service_tracker_pt tracker) {
 		}
 		arrayList_destroy(refs);
 	}
+    if (status == CELIX_SUCCESS) {
+        status = bundleContext_removeServiceListener(tracker->context, tracker->listener);
+    }
 
 	framework_logIfError(logger, status, NULL, "Cannot close tracker");
 


Mime
View raw message