kernel: Fix missing reference release in CreateThreadEvent.

CreateThreadEvent::DoDPC() missed a reference release to balance the
acquired reference before queuing the DPC, resulting in the
CreateThreadEvent objects being leaked.

This also removes the destructor that tried to cancel the DPC. Since
the class is reference counted and only destroyed when the DPC has
run and released the last reference, this didn't make much sense.
This commit is contained in:
Michael Lotz
2014-11-01 16:32:04 +01:00
parent f00353a519
commit bf685cdf2e
2 changed files with 2 additions and 9 deletions
-2
View File
@@ -86,8 +86,6 @@ private:
struct CreateThreadEvent : UserEvent, private DPCCallback { struct CreateThreadEvent : UserEvent, private DPCCallback {
~CreateThreadEvent();
static CreateThreadEvent* Create( static CreateThreadEvent* Create(
const ThreadCreationAttributes& attributes); const ThreadCreationAttributes& attributes);
+2 -7
View File
@@ -251,13 +251,6 @@ CreateThreadEvent::CreateThreadEvent(const ThreadCreationAttributes& attributes)
} }
CreateThreadEvent::~CreateThreadEvent()
{
// cancel the DPC to be on the safe side
DPCQueue::DefaultQueue(B_NORMAL_PRIORITY)->Cancel(this);
}
/*static*/ CreateThreadEvent* /*static*/ CreateThreadEvent*
CreateThreadEvent::Create(const ThreadCreationAttributes& attributes) CreateThreadEvent::Create(const ThreadCreationAttributes& attributes)
{ {
@@ -289,4 +282,6 @@ CreateThreadEvent::DoDPC(DPCQueue* queue)
thread_id threadID = thread_create_thread(fCreationAttributes, false); thread_id threadID = thread_create_thread(fCreationAttributes, false);
if (threadID >= 0) if (threadID >= 0)
resume_thread(threadID); resume_thread(threadID);
ReleaseReference();
} }