Make LLDB safer to use with respect to the global destructor chain.

llvm-svn: 262090
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 5534ab4..fd3df8f 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -59,13 +59,14 @@
 const ThreadPropertiesSP &
 Thread::GetGlobalProperties()
 {
-    static ThreadPropertiesSP g_settings_sp;
+    // NOTE: intentional leak so we don't crash if global destructor chain gets
+    // called as other threads still use the result of this function
+    static ThreadPropertiesSP *g_settings_sp_ptr = nullptr;
     static std::once_flag g_once_flag;
     std::call_once(g_once_flag,  []() {
-        if (!g_settings_sp)
-            g_settings_sp.reset (new ThreadProperties (true));
+        g_settings_sp_ptr = new ThreadPropertiesSP(new ThreadProperties (true));
     });
-    return g_settings_sp;
+    return *g_settings_sp_ptr;
 }
 
 static PropertyDefinition