Skip to content

Commit

Permalink
Fix up potential stale pointer after GC
Browse files Browse the repository at this point in the history
Fixes #16351

Signed-off-by: Tobi Ajila <atobia@ca.ibm.com>
  • Loading branch information
tajila committed Dec 5, 2022
1 parent d1e10d8 commit ef7a4c8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions runtime/j9vm/javanextvmi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ JVM_VirtualThreadMountEnd(JNIEnv *env, jobject thread, jboolean firstMount)
vmFuncs->setHeapOutOfMemoryError(currentThread);
goto release1;
}

/* Re-fetch as the memory allocation above may have moved the object. */
threadObj = J9_JNI_UNWRAP_REFERENCE(thread);

J9VMJAVALANGVIRTUALTHREAD_SET_STATE(currentThread, rootVirtualThread, J9VM_VIRTUALTHREAD_ROOT_NODE_STATE);
}

Expand Down

0 comments on commit ef7a4c8

Please sign in to comment.