Take ownership of any floating references in Bin::add/remove_element()

This commit is contained in:
Sebastian Dröge 2017-11-27 17:26:43 +02:00
parent 3f1eb96da9
commit a271b18c09

View file

@ -161,13 +161,12 @@ where
{ {
callback_guard!(); callback_guard!();
floating_reference_guard!(ptr); floating_reference_guard!(ptr);
floating_reference_guard!(element);
let bin = &*(ptr as *mut InstanceStruct<T>); let bin = &*(ptr as *mut InstanceStruct<T>);
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>); let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
let imp = &*bin.imp; let imp = &*bin.imp;
panic_to_error!(&wrap, &bin.panicked, false, { panic_to_error!(&wrap, &bin.panicked, false, {
imp.add_element(&wrap, &from_glib_borrow(element)) imp.add_element(&wrap, &from_glib_none(element))
}).to_glib() }).to_glib()
} }
@ -180,13 +179,12 @@ where
{ {
callback_guard!(); callback_guard!();
floating_reference_guard!(ptr); floating_reference_guard!(ptr);
floating_reference_guard!(element);
let bin = &*(ptr as *mut InstanceStruct<T>); let bin = &*(ptr as *mut InstanceStruct<T>);
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>); let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
let imp = &*bin.imp; let imp = &*bin.imp;
panic_to_error!(&wrap, &bin.panicked, false, { panic_to_error!(&wrap, &bin.panicked, false, {
imp.remove_element(&wrap, &from_glib_borrow(element)) imp.remove_element(&wrap, &from_glib_none(element))
}).to_glib() }).to_glib()
} }