Skip to content

Commit 3ec83cd

Browse files
committed
src: clear envinst_ after env
As long as env() doesn't return nullptr it is assumed that access to envinst_ is possible. So change the order of cleanup. PR-URL: #24 Reviewed-by: Santiago Gimeno <[email protected]>
1 parent 1dca94b commit 3ec83cd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/nsolid/nsolid_api.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,6 @@ void EnvList::RemoveEnv(Environment* env) {
973973
envinst_sp->env()->isolate()->RemoveGCEpilogueCallback(
974974
EnvInst::v8_gc_epilogue_cb_, envinst_sp.get());
975975

976-
// Remove the instance from env
977-
env->envinst_.reset();
978-
979976
// End any pending spans and notify the user.
980977
if (env->is_main_thread()) {
981978
tracer_.endPendingSpans();
@@ -997,6 +994,9 @@ void EnvList::RemoveEnv(Environment* env) {
997994
// and only accessed from another thread if the env still exists and has been
998995
// Scope locked.
999996
envinst_sp->env_.store(nullptr, std::memory_order_relaxed);
997+
998+
// Remove the instance from env
999+
env->envinst_.reset();
10001000
}
10011001

10021002

0 commit comments

Comments
 (0)