Skip to content

Commit 94ee9f2

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.
1 parent 6d12d0d commit 94ee9f2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/nsolid/nsolid_api.cc

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

971-
// Remove the instance from env
972-
env->envinst_.reset();
973-
974971
// End any pending spans and notify the user.
975972
if (env->is_main_thread()) {
976973
tracer_.endPendingSpans();
@@ -992,6 +989,9 @@ void EnvList::RemoveEnv(Environment* env) {
992989
// and only accessed from another thread if the env still exists and has been
993990
// Scope locked.
994991
envinst_sp->env_.store(nullptr, std::memory_order_relaxed);
992+
993+
// Remove the instance from env
994+
env->envinst_.reset();
995995
}
996996

997997

0 commit comments

Comments
 (0)