Fix an issue where certain CommandObjects (or Options thereof) were being created once, bound to a specific CommandInterpreter (and hence a specific Debugger), and then cached for reuse across different Debugger instances

Obviously, if the original Debugger goes away, those commands are holding on to now stale memory, which has the potential to cause crashes

Fixes rdar://24460882

llvm-svn: 259964
This commit is contained in:
Enrico Granata
2016-02-06 00:43:07 +00:00
parent 304ccee528
commit 0a66e2f135
5 changed files with 79 additions and 29 deletions

View File

@@ -4167,12 +4167,7 @@ RenderScriptRuntime::RenderScriptRuntime(Process *process)
lldb::CommandObjectSP
RenderScriptRuntime::GetCommandObject(lldb_private::CommandInterpreter &interpreter)
{
static CommandObjectSP command_object;
if (!command_object)
{
command_object.reset(new CommandObjectRenderScriptRuntime(interpreter));
}
return command_object;
return CommandObjectSP(new CommandObjectRenderScriptRuntime(interpreter));
}
RenderScriptRuntime::~RenderScriptRuntime() = default;