mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Bump layout data ref count in unsafe_set_layout_data
We need this or else we double-free the layout data box and crash.
This commit is contained in:
parent
4fd6ad3d5c
commit
4d76e7570e
1 changed files with 4 additions and 0 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue