From eebfc5b8acf466ae581c377e75f3f8b9f2428399 Mon Sep 17 00:00:00 2001 From: Zander Brown Date: Mon, 3 Feb 2025 15:21:47 +0000 Subject: [PATCH] gtk: don't leak snapshots --- gtk4/Gir.toml | 13 +++++++------ gtk4/src/auto/snapshot.rs | 36 +++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/gtk4/Gir.toml b/gtk4/Gir.toml index 3b12c59666eb..f84ce348d804 100644 --- a/gtk4/Gir.toml +++ b/gtk4/Gir.toml @@ -2080,9 +2080,6 @@ name = "Gtk.Snapshot" status = "generate" final_type = false manual_traits = ["SnapshotExtManual"] - [[object.function]] - pattern = "free_to_(node|paintable)" - ignore = true # C convenience functions [[object.function]] name = "append_border" manual = true @@ -2090,10 +2087,14 @@ manual_traits = ["SnapshotExtManual"] name = "push_debug" manual = true # ignore format args [[object.function]] + pattern = "free_to_node" + rename = "to_node" + [[object.function]] + pattern = "free_to_paintable" + rename = "to_paintable" + [[object.function]] pattern = "to_(node|paintable)" - [[object.function.parameter]] - name = "snapshot" - move = true + ignore = true [[object]] name = "Gtk.SortListModel" diff --git a/gtk4/src/auto/snapshot.rs b/gtk4/src/auto/snapshot.rs index 66b3e879ddac..83b8acdceb92 100644 --- a/gtk4/src/auto/snapshot.rs +++ b/gtk4/src/auto/snapshot.rs @@ -295,6 +295,27 @@ pub trait SnapshotExt: IsA + 'static { } } + #[doc(alias = "gtk_snapshot_free_to_node")] + #[doc(alias = "free_to_node")] + fn to_node(self) -> Option { + unsafe { + from_glib_full(ffi::gtk_snapshot_free_to_node( + self.upcast().into_glib_ptr(), + )) + } + } + + #[doc(alias = "gtk_snapshot_free_to_paintable")] + #[doc(alias = "free_to_paintable")] + fn to_paintable(self, size: Option<&graphene::Size>) -> Option { + unsafe { + from_glib_full(ffi::gtk_snapshot_free_to_paintable( + self.upcast().into_glib_ptr(), + size.to_glib_none().0, + )) + } + } + #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")] #[allow(deprecated)] #[doc(alias = "gtk_snapshot_gl_shader_pop_texture")] @@ -617,21 +638,6 @@ pub trait SnapshotExt: IsA + 'static { } } - #[doc(alias = "gtk_snapshot_to_node")] - fn to_node(self) -> Option { - unsafe { from_glib_full(ffi::gtk_snapshot_to_node(self.upcast().into_glib_ptr())) } - } - - #[doc(alias = "gtk_snapshot_to_paintable")] - fn to_paintable(self, size: Option<&graphene::Size>) -> Option { - unsafe { - from_glib_full(ffi::gtk_snapshot_to_paintable( - self.upcast().into_glib_ptr(), - size.to_glib_none().0, - )) - } - } - #[doc(alias = "gtk_snapshot_transform")] fn transform(&self, transform: Option<&gsk::Transform>) { unsafe {