File tree Expand file tree Collapse file tree
test-app/runtime/src/main Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33#include " NativeScriptException.h"
44#include " CallbackHandlers.h"
55#include " NativeScriptPlatform.h"
6+ #include " WorkerWrapper.h"
67#include < sstream>
78#include < android/log.h>
89
@@ -364,6 +365,11 @@ extern "C" JNIEXPORT void Java_com_tns_Runtime_TerminateRuntimeCallback(JNIEnv*
364365 auto isolate = runtime->GetIsolate ();
365366 auto eventLoop = runtime->GetEventLoop ();
366367
368+ // Terminate this runtime's child workers before disposing the isolate. Their
369+ // Worker object persistents live in this isolate, so they must be released
370+ // first - mirrors WorkerWrapper::BackgroundLooper's nested-worker teardown.
371+ WorkerWrapper::TerminateChildren (isolate);
372+
367373 {
368374 v8::Locker locker (isolate);
369375 v8::Isolate::Scope isolate_scope (isolate);
Original file line number Diff line number Diff line change @@ -486,6 +486,9 @@ static void destroyMainRuntime() {
486486 mainRuntime = null ;
487487 }
488488
489+ // Worker teardown happens natively in TerminateRuntimeCallback, which
490+ // terminates this runtime's child workers (WorkerWrapper registry) before
491+ // destroying the main isolate.
489492 TerminateRuntimeCallback (runtime .runtimeId );
490493 }
491494
You can’t perform that action at this time.
0 commit comments