diff options
-rw-r--r-- | src/plugins/debugger/console/console.cpp | 11 | ||||
-rw-r--r-- | src/plugins/debugger/console/console.h | 1 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/debugger/console/console.cpp b/src/plugins/debugger/console/console.cpp index 0f2cb819fc7..74800498fbb 100644 --- a/src/plugins/debugger/console/console.cpp +++ b/src/plugins/debugger/console/console.cpp @@ -283,11 +283,20 @@ void Console::evaluate(const QString &expression) } } +static Console *theConsole = nullptr; + Console *debuggerConsole() { - static Console *theConsole = new Console; + if (!theConsole) + theConsole = new Console; return theConsole; } +void destroyDebuggerConsole() +{ + delete theConsole; + theConsole = nullptr; +} + } // Internal } // Debugger diff --git a/src/plugins/debugger/console/console.h b/src/plugins/debugger/console/console.h index 962df2691f5..e68c5554714 100644 --- a/src/plugins/debugger/console/console.h +++ b/src/plugins/debugger/console/console.h @@ -99,6 +99,7 @@ private: }; Console *debuggerConsole(); +void destroyDebuggerConsole(); } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 70b36f73b0b..de8f1ce0ed3 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1038,7 +1038,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) DebuggerPluginPrivate::~DebuggerPluginPrivate() { - delete debuggerConsole(); + destroyDebuggerConsole(); qDeleteAll(m_optionPages); m_optionPages.clear(); |