From 9c3716756e4a20bcdb80291562a18b49568358cc Mon Sep 17 00:00:00 2001 From: Jason Perlow Date: Sun, 11 Oct 2026 11:26:46 -0400 Subject: [PATCH] fix(animation): bind the drag icon as unowned Gtk.DragIcon.get_for_drag is a named constructor in the current GTK vapi, so a plain call fails to compile and `new` would unref the drag icon the caller does not own. Bind gtk_drag_icon_get_for_drag as the unowned function it is. Assisted-by: DeepSeek:deepseek-flash AI-Scope: bound gtk_drag_icon_get_for_drag as an unowned static function in gdkextra.vapi and called it in drag_lift.vala. --- src/animation/drag_lift.vala | 2 +- src/vapi/gdkextra.vapi | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/animation/drag_lift.vala b/src/animation/drag_lift.vala index 1715aef..7a4e724 100644 --- a/src/animation/drag_lift.vala +++ b/src/animation/drag_lift.vala @@ -97,7 +97,7 @@ namespace Singularity.Animation { if (!use_icon || item.get_width() <= 0) return; var bin = build_icon(item); _icon_bin = bin; - var icon = Gtk.DragIcon.get_for_drag(drag) as Gtk.DragIcon; + var icon = GdkExtra.drag_icon_for_drag(drag) as Gtk.DragIcon; if (icon == null) return; icon.child = bin; double x = _press_x, y = _press_y; diff --git a/src/vapi/gdkextra.vapi b/src/vapi/gdkextra.vapi index 5171720..c801d65 100644 --- a/src/vapi/gdkextra.vapi +++ b/src/vapi/gdkextra.vapi @@ -21,4 +21,7 @@ namespace GdkExtra { [CCode (cname = "gdk_memory_texture_builder_build")] public Gdk.Texture build (); } + + [CCode (cname = "gtk_drag_icon_get_for_drag")] + public static unowned Gtk.Widget drag_icon_for_drag (Gdk.Drag drag); }