diff options
author | Johnny Chen <johnny.chen@apple.com> | 2010-08-23 17:13:12 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2010-08-23 17:13:12 +0000 |
commit | a73af6f6983f50484fdb05e7d5cd72f984dfafaf (patch) | |
tree | 0559d796f2353c9bc16023b04c4a9b726621862a | |
parent | d0190a618285cd48d996bc459c131f5ea3f66443 (diff) | |
download | bcm5719-llvm-a73af6f6983f50484fdb05e7d5cd72f984dfafaf.tar.gz bcm5719-llvm-a73af6f6983f50484fdb05e7d5cd72f984dfafaf.zip |
Fixed a crasher where during shutdown, loggings attempted to access the
thread name but the static map instance had already been destructed.
rdar://problem/8153284
llvm-svn: 111812
-rw-r--r-- | lldb/source/Host/macosx/Host.mm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index adef97f5a24..4bd78df1b51 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -325,7 +325,13 @@ ThreadNameAccessor (bool get, lldb::pid_t pid, lldb::tid_t tid, const char *name Mutex::Locker locker(&g_mutex); typedef std::map<uint64_t, std::string> thread_name_map; - static thread_name_map g_thread_names; + // rdar://problem/8153284 + // Fixed a crasher where during shutdown, loggings attempted to access the + // thread name but the static map instance had already been destructed. + // Another approach is to introduce a static guard object which monitors its + // own destruction and raises a flag, but this incurs more overhead. + static thread_name_map *g_thread_names_ptr = new thread_name_map(); + thread_name_map &g_thread_names = *g_thread_names_ptr; if (get) { |