Skip to content

Commit

Permalink
Fix context RefCount when debugger is enabled v0.2.26
Browse files Browse the repository at this point in the history
  • Loading branch information
rramachand21-zz committed Feb 21, 2017
1 parent c53c71e commit 6478fde
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/iisnode/cprotocolbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ HRESULT CProtocolBridge::InitiateRequest(CNodeHttpStoredContext* context)
IHttpContext* child = NULL;
BOOL completionExpected;
BOOL fCompletionPosted = FALSE;
BOOL fReference = FALSE;

// determine what the target path of the request is

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

context->ReferenceNodeHttpStoredContext();
fReference = TRUE;

CheckError(context->GetHttpContext()->ExecuteRequest(TRUE, child, 0, NULL, &completionExpected));
if (!completionExpected)
{
CProtocolBridge::ChildContextCompleted(S_OK, 0, context->GetOverlapped(), &fCompletionPosted);
context->DereferenceNodeHttpStoredContext();
fReference = FALSE;
}
}
else
Expand All @@ -565,6 +568,11 @@ HRESULT CProtocolBridge::InitiateRequest(CNodeHttpStoredContext* context)
context->SetChildContext(NULL);
}

if(fReference)
{
context->DereferenceNodeHttpStoredContext();
}

return hr;
}

Expand Down

0 comments on commit 6478fde

Please sign in to comment.