Skip to content

Commit 9b23c55

Browse files
committed
fix protected values destruction on shutdown
1 parent 8960b53 commit 9b23c55

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/realm-dart-extension/dart/dart_protected.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ class Protected {
6161
}
6262

6363
try {
64-
Dart_DeletePersistentHandle(m_ref);
64+
Dart_Isolate isolate = Dart_CurrentIsolate();
65+
//make sure there is current isolate. On Dart VM shutdown there might be no current isolate so just drop the handles
66+
if (isolate != nullptr) {
67+
Dart_DeletePersistentHandle(m_ref);
68+
}
6569
m_ref = nullptr;
6670
}
6771
catch (...) {}

0 commit comments

Comments
 (0)