]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Forbid access to async callback out of the relative async method
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 16 Apr 2011 08:17:21 +0000 (10:17 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Sat, 16 Apr 2011 08:19:18 +0000 (10:19 +0200)
Fixes bug 646945.

vala/valamemberaccess.vala

index 7f4b6dff08740fcbd935feef090e64d61d80ad70..26894ea69d2bab76536c91d12dbd37f23b84eff8 100644 (file)
@@ -539,6 +539,12 @@ public class Vala.MemberAccess : Expression {
                                // and also for lambda expressions within async methods
                                var async_method = context.analyzer.current_async_method;
 
+                               if (async_method == null || m != async_method.get_callback_method ()) {
+                                       error = true;
+                                       Report.error (source_reference, "Access to async callback `%s' not allowed in this context".printf (m.get_full_name ()));
+                                       return false;
+                               }
+
                                if (async_method != context.analyzer.current_method) {
                                        Symbol sym = context.analyzer.current_method;
                                        while (sym != async_method) {