summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexander Kutsan (GitHub) <akutsan@luxoft.com>2019-08-22 23:08:12 +0300
committerCollin <iCollin@users.noreply.github.com>2019-08-22 16:08:12 -0400
commit8db0c2601921fdd368bf86133780746b532c40f5 (patch)
treefd76b6fc43ab46ac571d06f95c2ce0cea04509e3 /CMakeLists.txt
parent0e57834d35230ddbe395096ace053414e811b980 (diff)
downloadsdl_core-8db0c2601921fdd368bf86133780746b532c40f5.tar.gz
Fix shutdown crash static var colission (#2939)
* Add apropriate destruction of plugins Add Delete exported function to each rpc plugin library Delete funciton will destroy Plugin instance. Move type defenition of PluginPtr to Plugin manager, because other components should use olugins only by referance. Add custom destructor for PluginPtr. custom destructor will call `Delete` function from shared library for plugin instance and unload plugin dl_handle. Deprecate GetPlugins method because it not used (and actualy shouldnt) by other components. Refactored LoadPlugin function, make it more readable, make this function as private RPCPluginManagerImpl private method. * Fix components dependencies after hiding libraries symbols * Add `-fvisibility=hidden` to avoid collision of static variables Remove from ABI all shared objects members except functions that needed. Fixes double destruction crash on shutdown. For the case if dynamically linked library contains same static variables as binary. System allocates the same memory for both static variables (in shared object and in binary). But during exit both binary and shared object destroying this memory. Mostly is a specific for binaries generated by gcc compiler. Inspired by https://stackoverflow.com/questions/3570355/c-fvisibility-hidden-fvisibility-inlines-hidden http://gcc.gnu.org/wiki/Visibility * Link Policy code statically SDL components like Application manager Connection Handler, etc ... requires symbols from policy library. Also policy library loaded by SDL in run-time as shared library. Having same library loaded as dynamic and shared library is definitely bad idea. This commit link extract static policy component and link policy component statically to other components. * Static linkage of plugins code un plugins unit tests Unit tests need to be portable and should not depend from dynamic libraries * Put logs_enabled_ "default" visibility attribute Logs enables is static variable and it should be shared across libraries. On SDL start if set_enabled_logs should put value shared across libraries * Changed the order of destruction of objects Changed the order of destruction of objects to avoid the crash during destruction of the RequestController. * Change the order of the waiting and finishing thread Applications using hotplug support should stop the thread at program exit and wait finishing thread after calling libusb_hotplug_deregister_callback. This call wakes up libusb_handle_events () http://libusb.sourceforge.net/api-1.0/group__libusb__asyncio.html * fixup! Add apropriate destruction of plugins * Make saftly usage of logger Added usage unique_ptr for LogMessageLoopThread to avoid the crash when delete_log_message_loop_thread was not fired.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38bb95c9fa..69c81f3310 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -237,7 +237,7 @@ set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
set(ARCHIVE_OUTPUT_DIRECTORY ./bin)
set(EXCLUDE_ERROR_FLAGS "-Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations")
-set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -Werror ${EXCLUDE_ERROR_FLAGS} -Wuninitialized -Wvla")
+set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -fvisibility=hidden -Werror ${EXCLUDE_ERROR_FLAGS} -Wuninitialized -Wvla")
if (USE_GOLD_LD)
execute_process(COMMAND ld -v OUTPUT_VARIABLE result)