From: Woongsuk Cho Date: Wed, 28 Nov 2018 06:13:02 +0000 (+0900) Subject: call pluginFinalize before coreclr shutdown and unload libplugin.so after coreclr... X-Git-Tag: submit/tizen_5.0/20181128.061753 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=370368d90cc0b672df3ceaa9b193ebc84ebeb19a;p=platform%2Fcore%2Fdotnet%2Flauncher.git call pluginFinalize before coreclr shutdown and unload libplugin.so after coreclr shutdown Change-Id: I79a716816a3397457d4f87499270b6e448154196 --- diff --git a/NativeLauncher/inc/plugin_manager.h b/NativeLauncher/inc/plugin_manager.h index f029750..534e0f8 100644 --- a/NativeLauncher/inc/plugin_manager.h +++ b/NativeLauncher/inc/plugin_manager.h @@ -51,6 +51,7 @@ void pluginSetAppInfo(const char* appId, const char* managedAssemblyPath); void pluginSetCoreclrInfo(void* hostHandle, unsigned int domainId, coreclr_create_delegate_ptr delegateFunc); char* pluginGetDllPath(); void pluginBeforeExecute(); +void pluginFinalize(); // initialize / finalize plugin manager int initializePluginManager(const char* mode); diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 7cd16b9..b0f78c5 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -410,8 +410,9 @@ bool CoreRuntime::initializeCoreClr(const char* appId, void CoreRuntime::dispose() { - // call finalize plugin callback before shutdown coreclr - finalizePluginManager(); + // call plugin finalize function to notify finalize to plugin + // dlclose shoud be done after coreclr shutdown to avoid breaking signal chain + pluginFinalize(); // ignore the signal generated by an exception that occurred during shutdown checkOnTerminate = true; @@ -431,6 +432,7 @@ void CoreRuntime::dispose() __coreclrLib = nullptr; } + finalizePluginManager(); finalizePathManager(); __envList.clear(); diff --git a/NativeLauncher/util/plugin_manager.cc b/NativeLauncher/util/plugin_manager.cc index 227e0a2..44b401d 100644 --- a/NativeLauncher/util/plugin_manager.cc +++ b/NativeLauncher/util/plugin_manager.cc @@ -55,10 +55,8 @@ int initializePluginManager(const char* mode) void finalizePluginManager() { + _INFO("Plugin manager finalize called"); if (__pluginFunc) { - if (__pluginFunc->finalize) { - __pluginFunc->finalize(); - } free(__pluginFunc); __pluginFunc = NULL; } @@ -115,3 +113,10 @@ void pluginBeforeExecute() } } +void pluginFinalize() +{ + if (__pluginFunc && __pluginFunc->finalize) { + __pluginFunc->finalize(); + } +} +