Correct the signature of flow_ref::deref_mut.

This also fixes Undefined Behavior in build_display_list_for_subtree.
This commit is contained in:
Ms2ger 2016-06-06 15:13:16 +02:00
parent 2e6711aa5f
commit 206d603f53
2 changed files with 2 additions and 2 deletions

View file

@ -20,7 +20,7 @@ pub type WeakFlowRef = Weak<Flow>;
/// 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)

View file

@ -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