From 25e83fd49fd093b8e4e6360a852c5595453e5f80 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Sat, 6 Apr 2024 15:21:38 +0200 Subject: [PATCH] gdk: Mark Texture builders destroy callbacks as Send As textures are thread-safe --- gdk4/src/dmabuf_texture_builder.rs | 6 ++++-- gdk4/src/gl_texture_builder.rs | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gdk4/src/dmabuf_texture_builder.rs b/gdk4/src/dmabuf_texture_builder.rs index 1a81f3874220..2e3c7eed5c3b 100644 --- a/gdk4/src/dmabuf_texture_builder.rs +++ b/gdk4/src/dmabuf_texture_builder.rs @@ -34,12 +34,14 @@ impl DmabufTextureBuilder { #[doc(alias = "gdk_dmabuf_texture_builder_build")] #[must_use = "The builder must be built to be used"] #[allow(clippy::missing_safety_doc)] - pub unsafe fn build_with_release_func( + pub unsafe fn build_with_release_func( self, release_func: F, ) -> Result { let mut error = std::ptr::null_mut(); - unsafe extern "C" fn destroy_closure(func: glib::ffi::gpointer) { + unsafe extern "C" fn destroy_closure( + func: glib::ffi::gpointer, + ) { let released_func = Box::::from_raw(func as *mut _); released_func(); } diff --git a/gdk4/src/gl_texture_builder.rs b/gdk4/src/gl_texture_builder.rs index 534385b64ec2..12baf089eac3 100644 --- a/gdk4/src/gl_texture_builder.rs +++ b/gdk4/src/gl_texture_builder.rs @@ -25,8 +25,13 @@ impl GLTextureBuilder { #[doc(alias = "gdk_gl_texture_builder_build")] #[must_use = "The builder must be built to be used"] #[allow(clippy::missing_safety_doc)] - pub unsafe fn build_with_release_func(self, release_func: F) -> Texture { - unsafe extern "C" fn destroy_closure(func: glib::ffi::gpointer) { + pub unsafe fn build_with_release_func( + self, + release_func: F, + ) -> Texture { + unsafe extern "C" fn destroy_closure( + func: glib::ffi::gpointer, + ) { let released_func = Box::::from_raw(func as *mut _); released_func(); }