From 57ec2ec012f5c9b5322be1e330cc3e747926bc0d Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 1 Sep 2021 10:55:53 -0700 Subject: [PATCH] fix: isolate dispose on app exit handling --- NativeScript/runtime/Runtime.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NativeScript/runtime/Runtime.mm b/NativeScript/runtime/Runtime.mm index d34696a9..f536ef7e 100644 --- a/NativeScript/runtime/Runtime.mm +++ b/NativeScript/runtime/Runtime.mm @@ -48,8 +48,10 @@ Runtime::isolates_.erase(std::remove(Runtime::isolates_.begin(), Runtime::isolates_.end(), this->isolate_), Runtime::isolates_.end()); - this->isolate_->Dispose(); - + if (![NSThread isMainThread]) { + this->isolate_->Dispose(); + } + currentRuntime_ = nullptr; }