celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1660399 - /celix/trunk/framework/private/src/resolver.c
Date Tue, 17 Feb 2015 14:51:31 GMT
Author: abroekhuis
Date: Tue Feb 17 14:51:31 2015
New Revision: 1660399

URL: http://svn.apache.org/r1660399
Log:
CELIX-219: Updated resolver to properly clean up capabilities when there are more then one.
The list is removed from the (un)resolved entries now as well.

Modified:
    celix/trunk/framework/private/src/resolver.c

Modified: celix/trunk/framework/private/src/resolver.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/resolver.c?rev=1660399&r1=1660398&r2=1660399&view=diff
==============================================================================
--- celix/trunk/framework/private/src/resolver.c (original)
+++ celix/trunk/framework/private/src/resolver.c Tue Feb 17 14:51:31 2015
@@ -289,24 +289,41 @@ void resolver_removeModule(module_pt mod
             list = resolver_getCapabilityList(m_unresolvedServices, serviceName);
             if (list != NULL) {
                 linkedList_removeElement(list->capabilities, cap);
-                linkedList_destroy(list->capabilities);
-                free(list->serviceName);
-                free(list);
+
+                if (linkedList_isEmpty(list->capabilities)) {
+					linkedList_removeElement(m_unresolvedServices, list);
+					linkedList_destroy(list->capabilities);
+					free(list->serviceName);
+					free(list);
+				}
             }
             list = resolver_getCapabilityList(m_resolvedServices, serviceName);
             if (list != NULL) {
                 linkedList_removeElement(list->capabilities, cap);
-                linkedList_destroy(list->capabilities);
-                free(list->serviceName);
-				free(list);
+
+                if (linkedList_isEmpty(list->capabilities)) {
+					linkedList_removeElement(m_resolvedServices, list);
+					linkedList_destroy(list->capabilities);
+					free(list->serviceName);
+					free(list);
+				}
             }
         }
     }
     if (linkedList_isEmpty(m_modules)) {
     	linkedList_destroy(m_modules);
     	m_modules = NULL;
+
+    	if (!linkedList_isEmpty(m_unresolvedServices)) {
+    		// #TODO: Something is wrong, not all modules have been removed from the resolver
+    		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Unexpected entries in unresolved module list");
+    	}
     	linkedList_destroy(m_unresolvedServices);
     	m_unresolvedServices = NULL;
+    	if (!linkedList_isEmpty(m_resolvedServices)) {
+			// #TODO: Something is wrong, not all modules have been removed from the resolver
+    		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Unexpected entries in resolved module list");
+		}
     	linkedList_destroy(m_resolvedServices);
     	m_resolvedServices = NULL;
     }



Mime
View raw message