diff options
author | Greg Clayton <gclayton@apple.com> | 2012-10-29 20:52:08 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-10-29 20:52:08 +0000 |
commit | 35a4cc5ea7020fbefd5f328a47d944b15cbda246 (patch) | |
tree | 8e45665751e40c27be4cf084361670323aada85d /lldb/source/Target/Thread.cpp | |
parent | c2cccd795f304f582d9146008f48e736262eac15 (diff) | |
download | bcm5719-llvm-35a4cc5ea7020fbefd5f328a47d944b15cbda246.tar.gz bcm5719-llvm-35a4cc5ea7020fbefd5f328a47d944b15cbda246.zip |
<rdar://problem/12500785>
I tracked down a leak that could happen when detaching from a process where the lldb_private::Process objects would stay around forever. This was caused by a eStateDetached event that was queued up on the lldb_private::Process private state thread listener. Since process events contain shared pointers to the process, this is dangerous if they don't get consume or cleared as having the lldb_private::Process class contain a collection of things that have a shared pointer to yourself is obviously bad.
To fix this I modified the Process::Finalize() function to clear this list. The actual thing that was holding onto the ModuleSP and thus the static archive, was a stack frame. Since the process wasn't going away, it still had thread objects and they still had frames. I modified the Thread::Destroy() to clear the stack frames to ensure this further doesn't happen.
llvm-svn: 166964
Diffstat (limited to 'lldb/source/Target/Thread.cpp')
-rw-r--r-- | lldb/source/Target/Thread.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 39157dd148f..a7f386480de 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -279,11 +279,16 @@ Thread::~Thread() void Thread::DestroyThread () { + m_destroy_called = true; m_plan_stack.clear(); m_discarded_plan_stack.clear(); m_completed_plan_stack.clear(); m_actual_stop_info_sp.reset(); - m_destroy_called = true; + m_reg_context_sp.reset(); + m_unwinder_ap.reset(); + Mutex::Locker locker(m_frame_mutex); + m_curr_frames_sp.reset(); + m_prev_frames_sp.reset(); } void |