From 6478fdea206547c4e1b0b0bb97186368d5a05f56 Mon Sep 17 00:00:00 2001 From: Ranjith Mukkai Ramachandra Date: Tue, 21 Feb 2017 14:56:02 -0800 Subject: [PATCH] Fix context RefCount when debugger is enabled v0.2.26 --- src/iisnode/cprotocolbridge.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/iisnode/cprotocolbridge.cpp b/src/iisnode/cprotocolbridge.cpp index 980d600e..ec7b2a75 100644 --- a/src/iisnode/cprotocolbridge.cpp +++ b/src/iisnode/cprotocolbridge.cpp @@ -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 @@ -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 @@ -565,6 +568,11 @@ HRESULT CProtocolBridge::InitiateRequest(CNodeHttpStoredContext* context) context->SetChildContext(NULL); } + if(fReference) + { + context->DereferenceNodeHttpStoredContext(); + } + return hr; }