From 0e39d2dae386e40bf2d7be8d299b3560d8fdb50e Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Mon, 26 May 2025 09:55:32 +0300 Subject: [PATCH] glib-2.0: Fix *.add_once () callbacks These callbacks have scope=async, not scope=call. In Vala, the latter is what passing an unowned delegate implies, while scope=async is achieved with an owned delegate marked [CCode (scope = "async")]. Fixes https://gitlab.gnome.org/GNOME/vala/issues/1556 --- vapi/glib-2.0.vapi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi index 9bbb7b759..7404b28d6 100644 --- a/vapi/glib-2.0.vapi +++ b/vapi/glib-2.0.vapi @@ -2087,14 +2087,14 @@ namespace GLib { public static uint add (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT); public static uint add_full (int priority, uint interval, owned SourceFunc function); [Version (since = "2.74")] - public static uint add_once (uint interval, SourceOnceFunc function); + public static uint add_once (uint interval, owned SourceOnceFunc function); [Version (since = "2.14")] [CCode (cname = "g_timeout_add_seconds_full")] public static uint add_seconds (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT); [Version (since = "2.14")] public static uint add_seconds_full (int priority, uint interval, owned SourceFunc function); [Version (since = "2.78")] - public static uint add_seconds_once (uint interval, SourceOnceFunc function); + public static uint add_seconds_once (uint interval, owned SourceOnceFunc function); } [CCode (cname = "GSource")] @@ -2107,7 +2107,7 @@ namespace GLib { public static uint add (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE); public static uint add_full (int priority, owned SourceFunc function); [Version (since = "2.74")] - public static uint add_once (SourceOnceFunc function); + public static uint add_once (owned SourceOnceFunc function); public static bool remove_by_data (void* data); } @@ -2258,6 +2258,7 @@ namespace GLib { public delegate bool SourceFunc (); [Version (since = "2.74")] + [CCode (scope = "async")] public delegate void SourceOnceFunc (); [CCode (has_type_id = false)] -- 2.47.2