mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1257,7 +1257,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js"
|
name = "js"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
source = "git+https://github.com/servo/rust-mozjs#568eccb62c8b139450d74bb8ed34e464ada715b2"
|
source = "git+https://github.com/servo/rust-mozjs#71acb0c504abbbc9c396bd78c71af4ec4ea91c88"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cmake 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cmake 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -15,6 +15,7 @@ use js::jsapi::{JSCompartment, JS_EnterCompartment, JS_LeaveCompartment, RemoveR
|
||||||
use js::jsapi::JSAutoCompartment;
|
use js::jsapi::JSAutoCompartment;
|
||||||
use js::jsapi::JS_GetProperty;
|
use js::jsapi::JS_GetProperty;
|
||||||
use js::jsval::{JSVal, UndefinedValue, ObjectValue};
|
use js::jsval::{JSVal, UndefinedValue, ObjectValue};
|
||||||
|
use js::rust::Runtime;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::mem::drop;
|
use std::mem::drop;
|
||||||
|
@ -88,7 +89,7 @@ impl Drop for CallbackObject {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let cx = GlobalScope::from_object(self.callback.get()).get_cx();
|
let cx = Runtime::get();
|
||||||
RemoveRawValueRoot(cx, self.permanent_js_root.get_unsafe());
|
RemoveRawValueRoot(cx, self.permanent_js_root.get_unsafe());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue