Skip to content

Commit 2bb05a8

Browse files
committed
chore: main merge
1 parent ad9b3d9 commit 2bb05a8

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

test-app/runtime/src/main/cpp/com_tns_Runtime.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
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);

test-app/runtime/src/main/java/com/tns/Runtime.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)