celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [28/50] celix git commit: CELIX-237: Fixed an issue in service_regisration, the ungetService for a service factory was not correctly called (wrong handle).
Date Tue, 27 Oct 2015 15:21:33 GMT
CELIX-237: Fixed an issue in service_regisration, the ungetService for a service factory was
not correctly called (wrong handle).


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

Branch: refs/heads/feature/CELIX-230_Refactoring_of_the_shell_command_service
Commit: aa1797ab90090ea556d4e367c390e5430cefea6c
Parents: 2fe04c0
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Thu Oct 15 09:56:00 2015 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Thu Oct 15 09:56:00 2015 +0200

----------------------------------------------------------------------
 framework/private/src/service_registration.c        |  2 +-
 .../rsa/private/src/import_registration_dfi.c       | 16 ++++++----------
 2 files changed, 7 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/aa1797ab/framework/private/src/service_registration.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_registration.c b/framework/private/src/service_registration.c
index 82d0ee9..1817784 100644
--- a/framework/private/src/service_registration.c
+++ b/framework/private/src/service_registration.c
@@ -163,7 +163,7 @@ celix_status_t serviceRegistration_getService(service_registration_pt
registrati
 celix_status_t serviceRegistration_ungetService(service_registration_pt registration, bundle_pt
bundle, void **service) {
     if (registration->isServiceFactory) {
         service_factory_pt factory = registration->serviceFactory;
-        factory->ungetService(registration->serviceFactory, bundle, registration, service);
+        factory->ungetService(factory->factory, bundle, registration, service);
     }
     return CELIX_SUCCESS;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/aa1797ab/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
index 8616f0c..cb40f0b 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
@@ -13,7 +13,6 @@ struct import_registration {
     const char *classObject; //NOTE owned by endpoint
 
     celix_thread_mutex_t mutex; //protects send & sendhandle
-
     send_func_type send;
     void *sendHandle;
 
@@ -27,7 +26,7 @@ struct import_registration {
 struct service_proxy {
     dyn_interface_type *intf;
     void *service;
-    int count;
+    size_t count;
 };
 
 static celix_status_t importRegistration_createProxy(import_registration_pt import, bundle_pt
bundle,
@@ -128,12 +127,13 @@ celix_status_t importRegistration_start(import_registration_pt import)
{
 celix_status_t importRegistration_stop(import_registration_pt import) {
     celix_status_t status = CELIX_SUCCESS;
 
-    importRegistration_clearProxies(import);
-
     if (import->factoryReg != NULL) {
         serviceRegistration_unregister(import->factoryReg);
+        import->factoryReg = NULL;
     }
 
+    importRegistration_clearProxies(import);
+
     return status;
 }
 
@@ -289,10 +289,6 @@ static void importRegistration_proxyFunc(void *userData, void *args[],
void *ret
 celix_status_t importRegistration_ungetService(import_registration_pt import, bundle_pt bundle,
service_registration_pt registration, void **out) {
     celix_status_t  status = CELIX_SUCCESS;
 
-    return status;
-
-    /* TODO, FIXME ungetService can happen after importRegistration destroy leading to segfaults
-
     assert(import != NULL);
     assert(import->proxies != NULL);
 
@@ -307,14 +303,14 @@ celix_status_t importRegistration_ungetService(import_registration_pt
import, bu
         }
 
         if (proxy->count == 0) {
+            hashMap_remove(import->proxies, bundle);
             importRegistration_destroyProxy(proxy);
         }
     }
 
-    pthread_mutex_lock(&import->proxiesMutex);
+    pthread_mutex_unlock(&import->proxiesMutex);
 
     return status;
-     */
 }
 
 static void importRegistration_destroyProxy(struct service_proxy *proxy) {


Mime
View raw message