servo: Merge #2607 - Fix leak (from brendanzab:leeeeeak); r=jdm
authorBrendan Zabarauskas <bjzaba@yahoo.com.au>
Fri, 06 Jun 2014 17:49:21 -0400
changeset 334494 405069dbff0fb3f97e1637786f963b7cb819dc75
parent 334493 d55fe8e24bb61341cc1256869fa2b224c8a6a682
child 334495 41325abb6071c3edef2f3505622a96a03f17eaea
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
servo: Merge #2607 - Fix leak (from brendanzab:leeeeeak); r=jdm Introduced by yours-truly in 7212c3573e7f2b13f907e17a5683d382b34ab932 Oopsie. Source-Repo: https://github.com/servo/servo Source-Revision: f1194fc85bfb857962684eccd352968b3ace7d84
servo/src/components/script/dom/node.rs
--- a/servo/src/components/script/dom/node.rs
+++ b/servo/src/components/script/dom/node.rs
@@ -125,16 +125,25 @@ impl NodeFlags {
     pub fn new(type_id: NodeTypeId) -> NodeFlags {
         match type_id {
             DocumentNodeTypeId => IsInDoc,
             _                  => NodeFlags::empty(),
         }
     }
 }
 
+#[unsafe_destructor]
+impl Drop for Node {
+    fn drop(&mut self) {
+        unsafe {
+            self.reap_layout_data();
+        }
+    }
+}
+
 /// suppress observers flag
 /// http://dom.spec.whatwg.org/#concept-node-insert
 /// http://dom.spec.whatwg.org/#concept-node-remove
 enum SuppressObserver {
     Suppressed,
     Unsuppressed
 }