From: Luca Bruno Date: Wed, 5 Jun 2013 20:58:10 +0000 (+0200) Subject: Warn when owned keyword is not used for called_once delegates X-Git-Tag: 0.21.1~50 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=21c8e57f3990774e28a97cbf644371b5c4183503;p=thirdparty%2Fvala.git Warn when owned keyword is not used for called_once delegates --- diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala index 91029d39e..92bd1e20c 100644 --- a/vala/valadelegatetype.vala +++ b/vala/valadelegatetype.vala @@ -113,6 +113,9 @@ public class Vala.DelegateType : DataType { } public override bool check (CodeContext context) { + if (is_called_once && !value_owned) { + Report.warning (source_reference, "delegates with scope=\"async\" must be owned"); + } return delegate_symbol.check (context); } diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi index 5c1868349..b45eee4dd 100644 --- a/vapi/glib-2.0.vapi +++ b/vapi/glib-2.0.vapi @@ -1693,17 +1693,17 @@ namespace GLib { #endif public class Thread { #if GLIB_2_32 - public Thread (string? name, ThreadFunc func); + public Thread (string? name, owned ThreadFunc func); [CCode (cname = "g_thread_try_new")] - public Thread.try (string? name, ThreadFunc func) throws GLib.Error; + public Thread.try (string? name, owned ThreadFunc func) throws GLib.Error; #endif public static bool supported (); [Deprecated (since = "2.32", replacement = "new Thread ()")] [CCode (simple_generics = true)] - public static unowned Thread create (ThreadFunc func, bool joinable) throws ThreadError; + public static unowned Thread create (owned ThreadFunc func, bool joinable) throws ThreadError; [Deprecated (since = "2.32", replacement = "new Thread ()")] [CCode (simple_generics = true)] - public static unowned Thread create_full (ThreadFunc func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError; + public static unowned Thread create_full (owned ThreadFunc func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError; [CCode (simple_generics = true)] public static unowned Thread self (); public T join ();