File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,7 +109,12 @@ void JsrtCallbackState::ObjectBeforeCallectCallbackWrapper(JsObjectBeforeCollect
109109 // we do not track the main thread. When it exits do the cleanup below
110110#ifdef CHAKRA_STATIC_LIBRARY
111111 atexit ([]() {
112- ThreadBoundThreadContextManager::DestroyContextAndEntryForCurrentThread ();
112+ ThreadContext *threadContext = ThreadContext::GetContextForCurrentThread ();
113+ if (threadContext)
114+ {
115+ if (threadContext->IsInScript ()) return ;
116+ ThreadBoundThreadContextManager::DestroyContextAndEntryForCurrentThread ();
117+ }
113118
114119 JsrtRuntime::Uninitialize ();
115120
Original file line number Diff line number Diff line change @@ -53,6 +53,9 @@ void JsrtRuntime::Uninitialize()
5353 while (currentThreadContext)
5454 {
5555 Assert (!currentThreadContext->IsScriptActive ());
56+ #ifdef CHAKRA_STATIC_LIBRARY
57+ if (currentThreadContext->IsInScript ()) break ;
58+ #endif
5659 JsrtRuntime* currentRuntime = static_cast <JsrtRuntime*>(currentThreadContext->GetJSRTRuntime ());
5760 tmpThreadContext = currentThreadContext;
5861 currentThreadContext = currentThreadContext->Next ();
You can’t perform that action at this time.
0 commit comments