celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] pnoltes commented on a change in pull request #293: Feature/add build to svc dep creation
Date Wed, 16 Dec 2020 14:49:40 GMT

pnoltes commented on a change in pull request #293:
URL: https://github.com/apache/celix/pull/293#discussion_r544358850



##########
File path: libs/framework/include/celix/dm/ServiceDependency_Impl.h
##########
@@ -22,11 +22,26 @@
 #include <cstring>
 #include "celix_constants.h"
 #include "celix_properties.h"
+#include "ServiceDependency.h"
+
 
 using namespace celix::dm;
 
+inline void BaseServiceDependency::runBuild() {
+    bool alreadyAdded = depAddedToCmp.exchange(true);
+    if (!alreadyAdded) {
+        celix_dmComponent_addServiceDependency(cCmp, cServiceDep);
+    }
+}
+
+inline BaseServiceDependency::~BaseServiceDependency() noexcept {
+    if (!depAddedToCmp) {

Review comment:
       This is correct. If a dependency is added to a dm component it will be destroyed when
the component is destroyed. 
   If a dependency is not added to a dm component (i.e. not build) it needs to be destroyed
explicitly. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message