mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #15108 - servo:callbackobject-drop, r=KiChjang
Don't try to get the global of an object while it's being destroyed. Fixes #15070. Fixes #15097. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15108) <!-- Reviewable:end -->
This commit is contained in:
commit
2c816a2e9d
2 changed files with 3 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1257,7 +1257,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.3"
|
||||
source = "git+https://github.com/servo/rust-mozjs#568eccb62c8b139450d74bb8ed34e464ada715b2"
|
||||
source = "git+https://github.com/servo/rust-mozjs#71acb0c504abbbc9c396bd78c71af4ec4ea91c88"
|
||||
dependencies = [
|
||||
"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)",
|
||||
|
|
|
@ -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