Skip to content

Commit 6478fde

Browse files
Fix context RefCount when debugger is enabled v0.2.26
1 parent c53c71e commit 6478fde

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/iisnode/cprotocolbridge.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ HRESULT CProtocolBridge::InitiateRequest(CNodeHttpStoredContext* context)
481481
IHttpContext* child = NULL;
482482
BOOL completionExpected;
483483
BOOL fCompletionPosted = FALSE;
484+
BOOL fReference = FALSE;
484485

485486
// determine what the target path of the request is
486487

@@ -541,12 +542,14 @@ HRESULT CProtocolBridge::InitiateRequest(CNodeHttpStoredContext* context)
541542
context->SetNextProcessor(CProtocolBridge::ChildContextCompleted);
542543

543544
context->ReferenceNodeHttpStoredContext();
545+
fReference = TRUE;
544546

545547
CheckError(context->GetHttpContext()->ExecuteRequest(TRUE, child, 0, NULL, &completionExpected));
546548
if (!completionExpected)
547549
{
548550
CProtocolBridge::ChildContextCompleted(S_OK, 0, context->GetOverlapped(), &fCompletionPosted);
549551
context->DereferenceNodeHttpStoredContext();
552+
fReference = FALSE;
550553
}
551554
}
552555
else
@@ -565,6 +568,11 @@ HRESULT CProtocolBridge::InitiateRequest(CNodeHttpStoredContext* context)
565568
context->SetChildContext(NULL);
566569
}
567570

571+
if(fReference)
572+
{
573+
context->DereferenceNodeHttpStoredContext();
574+
}
575+
568576
return hr;
569577
}
570578

0 commit comments

Comments
 (0)