aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script')
-rw-r--r--src/components/script/dom/node.rs4
-rw-r--r--src/components/script/script_task.rs15
2 files changed, 9 insertions, 10 deletions
diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs
index e797adb3e12..0936b9e490b 100644
--- a/src/components/script/dom/node.rs
+++ b/src/components/script/dom/node.rs
@@ -223,6 +223,10 @@ impl<'self, View> AbstractNode<View> {
/// Sets the layout data, unsafely casting the type as layout wishes. Only layout is allowed
/// to call this. This is wildly unsafe and is therefore marked as such.
pub unsafe fn unsafe_set_layout_data<T>(self, data: @mut T) {
+ // Don't decrement the refcount on data, since we're giving it to the
+ // base structure.
+ cast::forget(data);
+
do self.with_mut_base |base| {
base.layout_data = Some(transmute(data))
}
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