Skip to content

Commit 254693c

Browse files
committed
glib: Fix IntoGlibPtr implementation for BoxedInline
It was previously returning the stack allocated memory, which is invalid after the function returned.
1 parent 49f78b3 commit 254693c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

glib/src/boxed_inline.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,17 +527,15 @@ macro_rules! glib_boxed_inline_wrapper {
527527
impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::translate::IntoGlibPtr<*mut $ffi_name> for $name $(<$($generic),+>)? {
528528
#[inline]
529529
unsafe fn into_glib_ptr(self) -> *mut $ffi_name {
530-
let s = std::mem::ManuallyDrop::new(self);
531-
$crate::translate::ToGlibPtr::<*const $ffi_name>::to_glib_none(&*s).0 as *mut _
530+
$crate::translate::ToGlibPtr::<*const $ffi_name>::to_glib_full(&self) as *mut _
532531
}
533532
}
534533

535534
#[doc(hidden)]
536535
impl $(<$($generic $(: $bound $(+ $bound2)*)?),+>)? $crate::translate::IntoGlibPtr<*const $ffi_name> for $name $(<$($generic),+>)? {
537536
#[inline]
538537
unsafe fn into_glib_ptr(self) -> *const $ffi_name {
539-
let s = std::mem::ManuallyDrop::new(self);
540-
$crate::translate::ToGlibPtr::<*const $ffi_name>::to_glib_none(&*s).0 as *const _
538+
$crate::translate::ToGlibPtr::<*const $ffi_name>::to_glib_full(&self)
541539
}
542540
}
543541
};

0 commit comments

Comments
 (0)