mirror of
https://github.com/servo/servo.git
synced 2025-06-09 00:53:26 +00:00
Avoid accessing node global during Node's destructor.
This commit is contained in:
parent
3e95efdea6
commit
1449bac0e1
3 changed files with 42 additions and 13 deletions
|
@ -821,6 +821,23 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
}
|
||||
|
||||
impl ScriptThread {
|
||||
pub(crate) fn get_any_layout_chan() -> Option<Sender<Msg>> {
|
||||
SCRIPT_THREAD_ROOT.with(|root| {
|
||||
let script_thread = match root.get() {
|
||||
Some(s) => unsafe { &*s },
|
||||
None => return None,
|
||||
};
|
||||
script_thread
|
||||
.documents
|
||||
.borrow()
|
||||
.map
|
||||
.values()
|
||||
.next()
|
||||
.map(|d| d.window().layout_chan())
|
||||
.cloned()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn runtime_handle() -> ParentRuntime {
|
||||
SCRIPT_THREAD_ROOT.with(|root| {
|
||||
let script_thread = unsafe { &*root.get().unwrap() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue