Skip to content

Commit

Permalink
gtk: don't leak snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanderBrown committed Feb 3, 2025
1 parent 5664d6d commit eebfc5b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
13 changes: 7 additions & 6 deletions gtk4/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2080,20 +2080,21 @@ 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
[[object.function]]
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"
Expand Down
36 changes: 21 additions & 15 deletions gtk4/src/auto/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,27 @@ pub trait SnapshotExt: IsA<Snapshot> + 'static {
}
}

#[doc(alias = "gtk_snapshot_free_to_node")]
#[doc(alias = "free_to_node")]
fn to_node(self) -> Option<gsk::RenderNode> {
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<gdk::Paintable> {
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")]
Expand Down Expand Up @@ -617,21 +638,6 @@ pub trait SnapshotExt: IsA<Snapshot> + 'static {
}
}

#[doc(alias = "gtk_snapshot_to_node")]
fn to_node(self) -> Option<gsk::RenderNode> {
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<gdk::Paintable> {
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 {
Expand Down

0 comments on commit eebfc5b

Please sign in to comment.