gitlab#325 - rsvg_tree_free(): Cast the tree to our real Tree so it will get dropped
We had this: pub extern "C" fn rsvg_tree_free(tree: *mut RsvgTree) { if !tree.is_null() { let _ = unsafe { Box::from_raw(tree) }; ^ gets a Box<RsvgTree>, which is a box of a zero-sized enum I.e. it frees zero bytes :) With need this rebinding: let tree = unsafe { &mut *(tree as *mut Tree) }; i.e. cast tree as *mut Tree, so we'll end up with a Box<Tree> which *can* be dropped as appropriate. #325
Showing
-
mentioned in issue #325 (closed)
-
mentioned in merge request !161 (merged)
Please register or sign in to comment