mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Don't try to get the global of an object while it's being destroyed.
Fixes #15070. Fixes #15097.
This commit is contained in:
parent
b8df502491
commit
2071e41e64
2 changed files with 3 additions and 2 deletions
|
@ -15,6 +15,7 @@ use js::jsapi::{JSCompartment, JS_EnterCompartment, JS_LeaveCompartment, RemoveR
|
|||
use js::jsapi::JSAutoCompartment;
|
||||
use js::jsapi::JS_GetProperty;
|
||||
use js::jsval::{JSVal, UndefinedValue, ObjectValue};
|
||||
use js::rust::Runtime;
|
||||
use std::default::Default;
|
||||
use std::ffi::CString;
|
||||
use std::mem::drop;
|
||||
|
@ -88,7 +89,7 @@ impl Drop for CallbackObject {
|
|||
#[allow(unsafe_code)]
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
let cx = GlobalScope::from_object(self.callback.get()).get_cx();
|
||||
let cx = Runtime::get();
|
||||
RemoveRawValueRoot(cx, self.permanent_js_root.get_unsafe());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue