From: Luca Bruno Date: Sat, 16 Apr 2011 08:17:21 +0000 (+0200) Subject: Forbid access to async callback out of the relative async method X-Git-Tag: 0.13.0~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=474611603ae6df7792f4dc2f107fbafb77cc4f62;p=thirdparty%2Fvala.git Forbid access to async callback out of the relative async method Fixes bug 646945. --- diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala index 7f4b6dff0..26894ea69 100644 --- a/vala/valamemberaccess.vala +++ b/vala/valamemberaccess.vala @@ -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) {