From 9328b8def9446299b0809ca7d9619c039662cf97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Thu, 7 Nov 2024 09:06:18 +0100 Subject: [PATCH 1/3] gir: update for fix userdata mutability for FnMut callbacks --- gir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gir b/gir index a172dda2a728..e5ad53c3ad05 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit a172dda2a7283d286d45c237b0f8bc39b5354e94 +Subproject commit e5ad53c3ad05f06c499704f2d39d2a04c4111eb4 From 8e236c0755196a2aafbc42635aef6cfb55d27391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Thu, 7 Nov 2024 09:16:48 +0100 Subject: [PATCH 2/3] regenerate --- gdk-pixbuf/src/auto/versions.txt | 2 +- gdk-pixbuf/sys/versions.txt | 2 +- gio/src/auto/desktop_app_info.rs | 9 +++++---- gio/src/auto/file.rs | 12 ++++++------ gio/src/auto/versions.txt | 2 +- gio/sys/versions.txt | 2 +- glib/gobject-sys/versions.txt | 2 +- glib/src/auto/versions.txt | 2 +- glib/sys/versions.txt | 2 +- graphene/src/auto/versions.txt | 2 +- graphene/sys/versions.txt | 2 +- pango/src/auto/attr_list.rs | 6 +++--- pango/src/auto/fontset.rs | 6 +++--- pango/src/auto/versions.txt | 2 +- pango/sys/versions.txt | 2 +- pangocairo/src/auto/versions.txt | 2 +- pangocairo/sys/versions.txt | 2 +- 17 files changed, 30 insertions(+), 29 deletions(-) diff --git a/gdk-pixbuf/src/auto/versions.txt b/gdk-pixbuf/src/auto/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/gdk-pixbuf/src/auto/versions.txt +++ b/gdk-pixbuf/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/gdk-pixbuf/sys/versions.txt b/gdk-pixbuf/sys/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/gdk-pixbuf/sys/versions.txt +++ b/gdk-pixbuf/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/gio/src/auto/desktop_app_info.rs b/gio/src/auto/desktop_app_info.rs index 76e69c0fcef9..bbb79e97c463 100644 --- a/gio/src/auto/desktop_app_info.rs +++ b/gio/src/auto/desktop_app_info.rs @@ -218,7 +218,8 @@ impl DesktopAppInfo { } else { None }; - let pid_callback_data: Option<&mut dyn (FnMut(&DesktopAppInfo, glib::Pid))> = pid_callback; + let mut pid_callback_data: Option<&mut dyn (FnMut(&DesktopAppInfo, glib::Pid))> = + pid_callback; unsafe extern "C" fn pid_callback_func( appinfo: *mut ffi::GDesktopAppInfo, pid: glib::ffi::GPid, @@ -239,8 +240,8 @@ impl DesktopAppInfo { None }; let super_callback0: Box_>> = user_setup_data; - let super_callback1: &Option<&mut dyn (FnMut(&DesktopAppInfo, glib::Pid))> = - &pid_callback_data; + let super_callback1: &mut Option<&mut dyn (FnMut(&DesktopAppInfo, glib::Pid))> = + &mut pid_callback_data; unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::g_desktop_app_info_launch_uris_as_manager( @@ -251,7 +252,7 @@ impl DesktopAppInfo { user_setup, Box_::into_raw(super_callback0) as *mut _, pid_callback, - super_callback1 as *const _ as *mut _, + super_callback1 as *mut _ as *mut _, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); diff --git a/gio/src/auto/file.rs b/gio/src/auto/file.rs index 25d396eae118..7c4d0c949d70 100644 --- a/gio/src/auto/file.rs +++ b/gio/src/auto/file.rs @@ -224,7 +224,7 @@ pub trait FileExt: IsA + 'static { cancellable: Option<&impl IsA>, progress_callback: Option<&mut dyn (FnMut(i64, i64))>, ) -> Result<(), glib::Error> { - let progress_callback_data: Option<&mut dyn (FnMut(i64, i64))> = progress_callback; + let mut progress_callback_data: Option<&mut dyn (FnMut(i64, i64))> = progress_callback; unsafe extern "C" fn progress_callback_func( current_num_bytes: i64, total_num_bytes: i64, @@ -242,7 +242,7 @@ pub trait FileExt: IsA + 'static { } else { None }; - let super_callback0: &Option<&mut dyn (FnMut(i64, i64))> = &progress_callback_data; + let super_callback0: &mut Option<&mut dyn (FnMut(i64, i64))> = &mut progress_callback_data; unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::g_file_copy( @@ -251,7 +251,7 @@ pub trait FileExt: IsA + 'static { flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, progress_callback, - super_callback0 as *const _ as *mut _, + super_callback0 as *mut _ as *mut _, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); @@ -1252,7 +1252,7 @@ pub trait FileExt: IsA + 'static { cancellable: Option<&impl IsA>, progress_callback: Option<&mut dyn (FnMut(i64, i64))>, ) -> Result<(), glib::Error> { - let progress_callback_data: Option<&mut dyn (FnMut(i64, i64))> = progress_callback; + let mut progress_callback_data: Option<&mut dyn (FnMut(i64, i64))> = progress_callback; unsafe extern "C" fn progress_callback_func( current_num_bytes: i64, total_num_bytes: i64, @@ -1270,7 +1270,7 @@ pub trait FileExt: IsA + 'static { } else { None }; - let super_callback0: &Option<&mut dyn (FnMut(i64, i64))> = &progress_callback_data; + let super_callback0: &mut Option<&mut dyn (FnMut(i64, i64))> = &mut progress_callback_data; unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::g_file_move( @@ -1279,7 +1279,7 @@ pub trait FileExt: IsA + 'static { flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, progress_callback, - super_callback0 as *const _ as *mut _, + super_callback0 as *mut _ as *mut _, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); diff --git a/gio/src/auto/versions.txt b/gio/src/auto/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/gio/src/auto/versions.txt +++ b/gio/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/gio/sys/versions.txt b/gio/sys/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/gio/sys/versions.txt +++ b/gio/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/glib/gobject-sys/versions.txt b/glib/gobject-sys/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/glib/gobject-sys/versions.txt +++ b/glib/gobject-sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/glib/src/auto/versions.txt b/glib/src/auto/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/glib/src/auto/versions.txt +++ b/glib/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/glib/sys/versions.txt b/glib/sys/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/glib/sys/versions.txt +++ b/glib/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/graphene/src/auto/versions.txt b/graphene/src/auto/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/graphene/src/auto/versions.txt +++ b/graphene/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/graphene/sys/versions.txt b/graphene/sys/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/graphene/sys/versions.txt +++ b/graphene/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/pango/src/auto/attr_list.rs b/pango/src/auto/attr_list.rs index 363189c50fbc..e366296904d8 100644 --- a/pango/src/auto/attr_list.rs +++ b/pango/src/auto/attr_list.rs @@ -31,7 +31,7 @@ impl AttrList { #[doc(alias = "pango_attr_list_filter")] #[must_use] pub fn filter bool>(&self, func: P) -> Option { - let func_data: P = func; + let mut func_data: P = func; unsafe extern "C" fn func_func bool>( attribute: *mut ffi::PangoAttribute, user_data: glib::ffi::gpointer, @@ -41,12 +41,12 @@ impl AttrList { (*callback)(&attribute).into_glib() } let func = Some(func_func::

as _); - let super_callback0: &P = &func_data; + let super_callback0: &mut P = &mut func_data; unsafe { from_glib_full(ffi::pango_attr_list_filter( self.to_glib_none().0, func, - super_callback0 as *const _ as *mut _, + super_callback0 as *mut _ as *mut _, )) } } diff --git a/pango/src/auto/fontset.rs b/pango/src/auto/fontset.rs index 39ba51dbdb88..075193626146 100644 --- a/pango/src/auto/fontset.rs +++ b/pango/src/auto/fontset.rs @@ -21,7 +21,7 @@ impl Fontset { pub trait FontsetExt: IsA + 'static { #[doc(alias = "pango_fontset_foreach")] fn foreach bool>(&self, func: P) { - let func_data: P = func; + let mut func_data: P = func; unsafe extern "C" fn func_func bool>( fontset: *mut ffi::PangoFontset, font: *mut ffi::PangoFont, @@ -33,12 +33,12 @@ pub trait FontsetExt: IsA + 'static { (*callback)(&fontset, &font).into_glib() } let func = Some(func_func::

as _); - let super_callback0: &P = &func_data; + let super_callback0: &mut P = &mut func_data; unsafe { ffi::pango_fontset_foreach( self.as_ref().to_glib_none().0, func, - super_callback0 as *const _ as *mut _, + super_callback0 as *mut _ as *mut _, ); } } diff --git a/pango/src/auto/versions.txt b/pango/src/auto/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/pango/src/auto/versions.txt +++ b/pango/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/pango/sys/versions.txt b/pango/sys/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/pango/sys/versions.txt +++ b/pango/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/pangocairo/src/auto/versions.txt b/pangocairo/src/auto/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/pangocairo/src/auto/versions.txt +++ b/pangocairo/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) diff --git a/pangocairo/sys/versions.txt b/pangocairo/sys/versions.txt index 05568bf32ca4..9cb1c033d627 100644 --- a/pangocairo/sys/versions.txt +++ b/pangocairo/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ a172dda2a728) +Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) from gir-files (https://github.com/gtk-rs/gir-files @ f7af0e711383) From 8e29f889adfe8b3251531a9a6ca2550b94aa639b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Thu, 7 Nov 2024 09:36:18 +0100 Subject: [PATCH 3/3] glib: fix userdata mutability for FnMut callbacks --- glib/src/source.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/src/source.rs b/glib/src/source.rs index a1cf045b754b..7b835827619d 100644 --- a/glib/src/source.rs +++ b/glib/src/source.rs @@ -1092,9 +1092,9 @@ where ffi::g_source_set_callback( source, Some(transmute::< - *const (), + *mut (), unsafe extern "C" fn(ffi::gpointer) -> ffi::gboolean, - >(trampoline_child_watch:: as *const ())), + >(trampoline_child_watch:: as *mut ())), into_raw_child_watch(func), Some(destroy_closure_child_watch::), );