script: Handle null contexts better during JS runtime shutdown. (#34769)

* script: Handle null contexts better during JS runtime shutdown.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* lock file

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Josh Matthews 2024-12-26 03:23:27 -05:00 committed by GitHub
parent 981616f918
commit 4a6d2f8ff0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 41 additions and 30 deletions

View file

@ -78,9 +78,9 @@ impl Drop for Promise {
unsafe {
let object = self.permanent_js_root.get().to_object();
assert!(!object.is_null());
let cx = Runtime::get();
assert!(!cx.is_null());
RemoveRawValueRoot(cx, self.permanent_js_root.get_unsafe());
if let Some(cx) = Runtime::get() {
RemoveRawValueRoot(cx.as_ptr(), self.permanent_js_root.get_unsafe());
}
}
}
}