File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,11 @@ Debugger::Debugger(JsRuntimeHandle runtime)
192192
193193Debugger::~Debugger ()
194194{
195+ if (this ->m_context != JS_INVALID_REFERENCE)
196+ {
197+ ChakraRTInterface::JsRelease (this ->m_context , nullptr );
198+ this ->m_context = JS_INVALID_REFERENCE;
199+ }
195200 this ->m_runtime = JS_INVALID_RUNTIME_HANDLE;
196201}
197202
@@ -225,7 +230,9 @@ bool Debugger::Initialize()
225230 // Create a new context and run dbgcontroller.js in that context
226231 // setup dbgcontroller.js callbacks
227232
233+ Assert (this ->m_context == JS_INVALID_REFERENCE);
228234 IfJsrtErrorFailLogAndRetFalse (ChakraRTInterface::JsCreateContext (this ->m_runtime , &this ->m_context ));
235+ IfJsrtErrorFailLogAndRetFalse (ChakraRTInterface::JsAddRef (this ->m_context , nullptr )); // Pin context
229236
230237 AutoRestoreContext autoRestoreContext (this ->m_context );
231238
You can’t perform that action at this time.
0 commit comments