[vala] Forbid access to async callback out of the relative async method



commit 474611603ae6df7792f4dc2f107fbafb77cc4f62
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Apr 16 10:17:21 2011 +0200

    Forbid access to async callback out of the relative async method
    
    Fixes bug 646945.

 vala/valamemberaccess.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 7f4b6df..26894ea 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) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]