]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Warn when owned keyword is not used for called_once delegates
authorLuca Bruno <lucabru@src.gnome.org>
Wed, 5 Jun 2013 20:58:10 +0000 (22:58 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Wed, 5 Jun 2013 20:59:30 +0000 (22:59 +0200)
vala/valadelegatetype.vala
vapi/glib-2.0.vapi

index 91029d39e663881d76c2a9f17701394f7ed3a61e..92bd1e20cfc519acee44ec3853b3b00b7bccc48c 100644 (file)
@@ -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);
        }
 
index 5c18683499c23f1d127f1c62db6ae00c038b16c3..b45eee4dd83a70ddba00cfcab509938df5582a67 100644 (file)
@@ -1693,17 +1693,17 @@ namespace GLib {
 #endif
        public class Thread<T> {
 #if GLIB_2_32
-               public Thread (string? name, ThreadFunc<T> func);
+               public Thread (string? name, owned ThreadFunc<T> func);
                [CCode (cname = "g_thread_try_new")]
-               public Thread.try (string? name, ThreadFunc<T> func) throws GLib.Error;
+               public Thread.try (string? name, owned ThreadFunc<T> func) throws GLib.Error;
 #endif
                public static bool supported ();
                [Deprecated (since = "2.32", replacement = "new Thread<T> ()")]
                [CCode (simple_generics = true)]
-               public static unowned Thread<T> create<T> (ThreadFunc<T> func, bool joinable) throws ThreadError;
+               public static unowned Thread<T> create<T> (owned ThreadFunc<T> func, bool joinable) throws ThreadError;
                [Deprecated (since = "2.32", replacement = "new Thread<T> ()")]
                [CCode (simple_generics = true)]
-               public static unowned Thread<T> create_full<T> (ThreadFunc<T> func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
+               public static unowned Thread<T> create_full<T> (owned ThreadFunc<T> func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
                [CCode (simple_generics = true)]
                public static unowned Thread<T> self<T> ();
                public T join ();