From b184bfa13b9f930f1077bc8e670b2ae46b3cce2e Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Tue, 12 Apr 2016 01:08:35 +0000 Subject: [PATCH] Restore the lazy initialization of ScriptInterpreterPython, which was lost as part of the SystemLifetimeManager work llvm-svn: 266033 --- .../ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 10 +++++----- .../Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 0af1fd5..104a23e 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -274,8 +274,8 @@ ScriptInterpreterPython::ScriptInterpreterPython(CommandInterpreter &interpreter m_lock_count(0), m_command_thread_state(nullptr) { - assert(g_initialized && "ScriptInterpreterPython created but InitializePrivate has not been called!"); - + InitializePrivate(); + m_dictionary_name.append("_dict"); StreamString run_string; run_string.Printf ("%s = dict()", m_dictionary_name.c_str()); @@ -330,8 +330,6 @@ ScriptInterpreterPython::Initialize() std::call_once(g_once_flag, []() { - InitializePrivate(); - PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), lldb::eScriptLanguagePython, @@ -3097,7 +3095,9 @@ ScriptInterpreterPython::InitializeInterpreter (SWIGInitCallback swig_init_callb void ScriptInterpreterPython::InitializePrivate () { - assert(!g_initialized && "ScriptInterpreterPython::InitializePrivate() called more than once!"); + if (g_initialized) + return; + g_initialized = true; Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h index 83702a0..86de2dd 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -372,9 +372,6 @@ public: void ResetOutputFileHandle(FILE *new_fh) override; static void - InitializePrivate (); - - static void InitializeInterpreter (SWIGInitCallback python_swig_init_callback, SWIGBreakpointCallbackFunction swig_breakpoint_callback, SWIGWatchpointCallbackFunction swig_watchpoint_callback, @@ -507,6 +504,9 @@ public: }; protected: + static void + InitializePrivate (); + class SynchronicityHandler { private: -- 2.7.4