Skip to content

Commit

Permalink
Fix double dlclose when uninstalling bundle without activator
Browse files Browse the repository at this point in the history
For bundle without activator, all handles of its shared objects are
immediately closed after dlopen. Thus they should NOT be added to a
revision's handle-list.
  • Loading branch information
PengZheng committed Dec 1, 2020
1 parent 2546c64 commit 2142389
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions libs/framework/src/framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,16 @@ static celix_status_t framework_loadLibraries(framework_pt framework, const char
status = framework_loadLibrary(framework, trimmedLib, archive, &handle);

if ( (status == CELIX_SUCCESS) && (activator != NULL) && (strcmp(trimmedLib, activator) == 0) ) {
bundle_revision_pt revision = NULL;
array_list_pt handles = NULL;

status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
status = CELIX_DO_IF(status, bundleRevision_getHandles(revision, &handles));

if(handles != NULL){
arrayList_add(handles, handle);
}

*activatorHandle = handle;
}
else if(handle!=NULL){
Expand Down Expand Up @@ -2307,16 +2317,6 @@ static celix_status_t framework_loadLibrary(framework_pt framework, const char *
if (*handle == NULL) {
error = celix_libloader_getLastError();
status = CELIX_BUNDLE_EXCEPTION;
} else {
bundle_revision_pt revision = NULL;
array_list_pt handles = NULL;

status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
status = CELIX_DO_IF(status, bundleRevision_getHandles(revision, &handles));

if(handles != NULL){
arrayList_add(handles, *handle);
}
}
}

Expand Down

0 comments on commit 2142389

Please sign in to comment.