diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-05-05 09:11:30 -0500 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-05-05 09:11:30 -0500 |
commit | 49aed6555dbc008c1a378c5cbb303f5467232b6b (patch) | |
tree | 9146cdd7126ead59c57cacbaa04eda0f16761f65 /components/layout/flow_ref.rs | |
parent | 7b87085c1880c60aa3be5b3ec4572a0d93fd5537 (diff) | |
parent | ef8edd4e87aeb3cc71dfd9da2f69437080f5410e (diff) | |
download | servo-49aed6555dbc008c1a378c5cbb303f5467232b6b.tar.gz servo-49aed6555dbc008c1a378c5cbb303f5467232b6b.zip |
Auto merge of #5935 - servo:rustup_2015-04-25, r=Ms2ger
r? everybody
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5935)
<!-- Reviewable:end -->
Diffstat (limited to 'components/layout/flow_ref.rs')
-rw-r--r-- | components/layout/flow_ref.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs index 9a8e2bb580e..6b323c15f6f 100644 --- a/components/layout/flow_ref.rs +++ b/components/layout/flow_ref.rs @@ -78,7 +78,8 @@ impl DerefMut for FlowRef { impl Drop for FlowRef { fn drop(&mut self) { unsafe { - if self.object.vtable.is_null() { + if self.object.vtable.is_null() || + self.object.vtable as usize == mem::POST_DROP_USIZE { return } if flow::base(&**self).strong_ref_count().fetch_sub(1, Ordering::Release) != 1 { @@ -102,7 +103,7 @@ impl Drop for FlowRef { let object_align = vtable[2]; let fake_data = heap::allocate(object_size, object_align); - ptr::copy(fake_data, flow_ref.object.data as *const u8, object_size); + ptr::copy(flow_ref.object.data as *const u8, fake_data, object_size); let fake_box = raw::TraitObject { vtable: flow_ref.object.vtable, data: fake_data as *mut () }; let fake_flow = mem::transmute::<raw::TraitObject, Box<Flow>>(fake_box); @@ -181,7 +182,8 @@ impl Clone for WeakFlowRef { impl Drop for WeakFlowRef { fn drop(&mut self) { unsafe { - if self.object.vtable.is_null() { + if self.object.vtable.is_null() || + self.object.vtable as usize == mem::POST_DROP_USIZE { return } |