aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2019-12-19 18:15:30 -0500
committerJosh Matthews <josh@joshmatthews.net>2020-02-24 16:27:40 -0500
commit1449bac0e19bfafbb14a71c3bb246ad28ddbf8e8 (patch)
tree738882ff53ca00c251c939917ce73a65605f4b05 /components/script/script_thread.rs
parent3e95efdea62266c756b04f7557cf1bd3f36f3b87 (diff)
downloadservo-1449bac0e19bfafbb14a71c3bb246ad28ddbf8e8.tar.gz
servo-1449bac0e19bfafbb14a71c3bb246ad28ddbf8e8.zip
Avoid accessing node global during Node's destructor.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 118b4b4f653..dd0f798fcec 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -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() };