From 4fd6ad3d5cca30f737e820ac273c794aec93cd93 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Mon, 15 Jul 2013 10:37:57 -0700 Subject: Move script local_data_pop out of dtor Fixes #570, which was caused by a second reentrant call to the dtor. --- src/components/script/script_task.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/components/script/script_task.rs') diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 0c5e9c4af4f..c3b574413c9 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -167,15 +167,6 @@ pub fn task_from_context(js_context: *JSContext) -> *mut ScriptTask { } } -#[unsafe_destructor] -impl Drop for ScriptTask { - fn drop(&self) { - unsafe { - let _ = local_data::local_data_pop(global_script_context_key); - } - } -} - impl ScriptTask { /// Creates a new script task. pub fn new(id: uint, @@ -362,7 +353,11 @@ impl ScriptTask { frame.document.teardown(); } - self.layout_chan.send(layout_interface::ExitMsg) + self.layout_chan.send(layout_interface::ExitMsg); + + unsafe { + let _ = local_data::local_data_pop(global_script_context_key); + } } /// The entry point to document loading. Defines bindings, sets up the window and document -- cgit v1.2.3