diff --git a/gtk4/src/print_job.rs b/gtk4/src/print_job.rs index 8135bca5ea67..1c8c6a0b207e 100644 --- a/gtk4/src/print_job.rs +++ b/gtk4/src/print_job.rs @@ -8,22 +8,24 @@ use crate::PrintJob; impl PrintJob { #[doc(alias = "gtk_print_job_send")] - pub fn send(&self, callback: P) { + pub fn send) + 'static>(&self, callback: P) { let callback_data: Box_

= Box_::new(callback); - unsafe extern "C" fn callback_func( + unsafe extern "C" fn callback_func) + 'static>( print_job: *mut ffi::GtkPrintJob, user_data: glib::ffi::gpointer, error: *const glib::ffi::GError, ) { let print_job = from_glib_borrow(print_job); - let error = from_glib_borrow(error); + let result = if error.is_null() { + Ok(()) + } else { + Err(from_glib_none(error)) + }; let callback: &P = &*(user_data as *mut _); - (*callback)(&print_job, &error); + (*callback)(&print_job, result); } let callback = Some(callback_func::

as _); - unsafe extern "C" fn dnotify_func( - data: glib::ffi::gpointer, - ) { + unsafe extern "C" fn dnotify_func

(data: glib::ffi::gpointer) { let _callback: Box_

= Box_::from_raw(data as *mut _); } let destroy_call3 = Some(dnotify_func::

as _);