]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
glib-2.0: Fix *.add_once () callbacks
authorSergey Bugaev <bugaevc@gmail.com>
Mon, 26 May 2025 06:55:32 +0000 (09:55 +0300)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 11 Jun 2025 10:36:50 +0000 (12:36 +0200)
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

index 9bbb7b7597c3b30a4696c7697dcc294cfdee21e9..7404b28d606baf04cf443effcc871c650318071f 100644 (file)
@@ -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)]