<rdar://problem/12500785>
authorGreg Clayton <gclayton@apple.com>
Mon, 29 Oct 2012 20:52:08 +0000 (20:52 +0000)
committerGreg Clayton <gclayton@apple.com>
Mon, 29 Oct 2012 20:52:08 +0000 (20:52 +0000)
commit35a4cc5ea7020fbefd5f328a47d944b15cbda246
tree8e45665751e40c27be4cf084361670323aada85d
parentc2cccd795f304f582d9146008f48e736262eac15
<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
lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
lldb/source/Target/Process.cpp
lldb/source/Target/Thread.cpp