diff options
author | Greg Clayton <gclayton@apple.com> | 2012-01-27 18:08:35 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-01-27 18:08:35 +0000 |
commit | b26e6bebac9c82c0e0fb92ae7e8a10ab4fb975cd (patch) | |
tree | 40a5af104a9ef9d62150361989057682d064cb67 /lldb/source/Core/Module.cpp | |
parent | f519564d7ce2bd8d3f724f599f1626a58b45ea50 (diff) | |
download | bcm5719-llvm-b26e6bebac9c82c0e0fb92ae7e8a10ab4fb975cd.tar.gz bcm5719-llvm-b26e6bebac9c82c0e0fb92ae7e8a10ab4fb975cd.zip |
Fixed an issue that could happen during global object destruction in our
map that tracks all live Module classes. We must leak our mutex for our
collection class as it might be destroyed in an order we can't control.
llvm-svn: 149131
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r-- | lldb/source/Core/Module.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index ea16376aa34..62b25c50015 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -43,11 +43,18 @@ GetModuleCollection() return *g_module_collection; } -Mutex & +Mutex * Module::GetAllocationModuleCollectionMutex() { - static Mutex g_module_collection_mutex(Mutex::eMutexTypeRecursive); - return g_module_collection_mutex; + // NOTE: The mutex below must be leaked since the global module list in + // the ModuleList class will get torn at some point, and we can't know + // if it will tear itself down before the "g_module_collection_mutex" below + // will. So we leak a Mutex object below to safeguard against that + + static Mutex *g_module_collection_mutex = NULL; + if (g_module_collection_mutex == NULL) + g_module_collection_mutex = new Mutex (Mutex::eMutexTypeRecursive); // NOTE: known leak + return g_module_collection_mutex; } size_t |