Skip to content

Commit

Permalink
Merge pull request #1566 from fengalin/fix-callback-userdata-mutability
Browse files Browse the repository at this point in the history
Fix callback userdata mutability
  • Loading branch information
sdroege authored Nov 7, 2024
2 parents cc97e01 + 8e29f88 commit 6da7aba
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion gdk-pixbuf/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 5 additions & 4 deletions gio/src/auto/desktop_app_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -239,8 +240,8 @@ impl DesktopAppInfo {
None
};
let super_callback0: Box_<Option<Box_<dyn FnOnce() + 'static>>> = 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(
Expand All @@ -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());
Expand Down
12 changes: 6 additions & 6 deletions gio/src/auto/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub trait FileExt: IsA<File> + 'static {
cancellable: Option<&impl IsA<Cancellable>>,
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,
Expand All @@ -242,7 +242,7 @@ pub trait FileExt: IsA<File> + '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(
Expand All @@ -251,7 +251,7 @@ pub trait FileExt: IsA<File> + '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());
Expand Down Expand Up @@ -1252,7 +1252,7 @@ pub trait FileExt: IsA<File> + 'static {
cancellable: Option<&impl IsA<Cancellable>>,
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,
Expand All @@ -1270,7 +1270,7 @@ pub trait FileExt: IsA<File> + '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(
Expand All @@ -1279,7 +1279,7 @@ pub trait FileExt: IsA<File> + '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());
Expand Down
2 changes: 1 addition & 1 deletion gio/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion gio/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion glib/gobject-sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion glib/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions glib/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<F> as *const ())),
>(trampoline_child_watch::<F> as *mut ())),
into_raw_child_watch(func),
Some(destroy_closure_child_watch::<F>),
);
Expand Down
2 changes: 1 addition & 1 deletion glib/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion graphene/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion graphene/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions pango/src/auto/attr_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl AttrList {
#[doc(alias = "pango_attr_list_filter")]
#[must_use]
pub fn filter<P: FnMut(&Attribute) -> bool>(&self, func: P) -> Option<AttrList> {
let func_data: P = func;
let mut func_data: P = func;
unsafe extern "C" fn func_func<P: FnMut(&Attribute) -> bool>(
attribute: *mut ffi::PangoAttribute,
user_data: glib::ffi::gpointer,
Expand All @@ -41,12 +41,12 @@ impl AttrList {
(*callback)(&attribute).into_glib()
}
let func = Some(func_func::<P> 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 _,
))
}
}
Expand Down
6 changes: 3 additions & 3 deletions pango/src/auto/fontset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Fontset {
pub trait FontsetExt: IsA<Fontset> + 'static {
#[doc(alias = "pango_fontset_foreach")]
fn foreach<P: FnMut(&Fontset, &Font) -> bool>(&self, func: P) {
let func_data: P = func;
let mut func_data: P = func;
unsafe extern "C" fn func_func<P: FnMut(&Fontset, &Font) -> bool>(
fontset: *mut ffi::PangoFontset,
font: *mut ffi::PangoFont,
Expand All @@ -33,12 +33,12 @@ pub trait FontsetExt: IsA<Fontset> + 'static {
(*callback)(&fontset, &font).into_glib()
}
let func = Some(func_func::<P> 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 _,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion pango/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pango/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pangocairo/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pangocairo/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 6da7aba

Please sign in to comment.