forked from OSchip/llvm-project
Make LLDB safer to use with respect to the global destructor chain.
llvm-svn: 262090
This commit is contained in:
parent
0c95decaaa
commit
cc2e27f098
|
@ -833,13 +833,14 @@ Process::~Process()
|
|||
const ProcessPropertiesSP &
|
||||
Process::GetGlobalProperties()
|
||||
{
|
||||
static ProcessPropertiesSP 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 ProcessPropertiesSP *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 ProcessProperties (NULL));
|
||||
g_settings_sp_ptr = new ProcessPropertiesSP(new ProcessProperties (NULL));
|
||||
});
|
||||
return g_settings_sp;
|
||||
return *g_settings_sp_ptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -2778,13 +2778,14 @@ Target::RunStopHooks ()
|
|||
const TargetPropertiesSP &
|
||||
Target::GetGlobalProperties()
|
||||
{
|
||||
static TargetPropertiesSP 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 TargetPropertiesSP *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 TargetProperties(nullptr));
|
||||
g_settings_sp_ptr = new TargetPropertiesSP(new TargetProperties(nullptr));
|
||||
});
|
||||
return g_settings_sp;
|
||||
return *g_settings_sp_ptr;
|
||||
}
|
||||
|
||||
Error
|
||||
|
|
|
@ -59,13 +59,14 @@ using namespace lldb_private;
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue