From 206d603f53f0f7fb8709f1bd734f722020d8d5f2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 6 Jun 2016 15:13:16 +0200 Subject: [PATCH] Correct the signature of flow_ref::deref_mut. This also fixes Undefined Behavior in build_display_list_for_subtree. --- components/layout/flow_ref.rs | 2 +- components/layout/sequential.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs index b2dcc5c34fa..d1717ef2000 100644 --- a/components/layout/flow_ref.rs +++ b/components/layout/flow_ref.rs @@ -20,7 +20,7 @@ pub type WeakFlowRef = Weak; /// See https://github.com/servo/servo/issues/6503 /// Use Arc::get_mut instead when possible (e.g. on an Arc that was just created). #[allow(unsafe_code)] -pub fn deref_mut<'a>(r: &mut FlowRef) -> &'a mut Flow { +pub fn deref_mut<'a>(r: &'a mut FlowRef) -> &'a mut Flow { let ptr: *const Flow = &**r; unsafe { &mut *(ptr as *mut Flow) diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index d652d19b773..6663843f572 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -87,7 +87,7 @@ pub fn build_display_list_for_subtree(root: &mut FlowRef, &mut root_stacking_context.children); let mut build_display_list = BuildDisplayList { state: DisplayListBuildState::new(&layout_context, - flow::base(&**root).stacking_context_id), + flow::base(&*flow_root).stacking_context_id), }; build_display_list.traverse(&mut *flow_root); build_display_list.state.items