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:
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user