[vala/0.10] D-Bus: Fix crash for properties with unowned getter in GDBus servers



commit 805534c3928123449ac91b9f0eeeefb5bb2f9ff1
Author: Jürg Billeter <j bitron ch>
Date:   Wed Oct 20 23:26:17 2010 +0200

    D-Bus: Fix crash for properties with unowned getter in GDBus servers
    
    Fixes bug 630832.

 codegen/valagdbusservermodule.vala |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index a3bfbcc..bb5ec96 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -455,22 +455,22 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 		var ccall = new CCodeFunctionCall (new CCodeIdentifier (prop.get_accessor.get_cname ()));
 		ccall.add_argument (new CCodeIdentifier ("self"));
 
-		if (prop.property_type.is_real_non_null_struct_type ()) {
-			cdecl = new CCodeDeclaration (prop.property_type.get_cname ());
-			cdecl.add_declarator (new CCodeVariableDeclarator.zero ("result", default_value_for_type (prop.property_type, true)));
+		if (prop.get_accessor.value_type.is_real_non_null_struct_type ()) {
+			cdecl = new CCodeDeclaration (prop.get_accessor.value_type.get_cname ());
+			cdecl.add_declarator (new CCodeVariableDeclarator.zero ("result", default_value_for_type (prop.get_accessor.value_type, true)));
 			prefragment.append (cdecl);
 
 			ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("result")));
 
 			block.add_statement (new CCodeExpressionStatement (ccall));
 		} else {
-			cdecl = new CCodeDeclaration (prop.property_type.get_cname ());
+			cdecl = new CCodeDeclaration (prop.get_accessor.value_type.get_cname ());
 			cdecl.add_declarator (new CCodeVariableDeclarator ("result"));
 			prefragment.append (cdecl);
 
 			block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("result"), ccall)));
 
-			var array_type = prop.property_type as ArrayType;
+			var array_type = prop.get_accessor.value_type as ArrayType;
 			if (array_type != null) {
 				for (int dim = 1; dim <= array_type.rank; dim++) {
 					string length_cname = get_array_length_cname ("result", dim);
@@ -484,18 +484,18 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 			}
 		}
 
-		var reply_expr = serialize_expression (postfragment, prop.property_type, new CCodeIdentifier ("result"));
+		var reply_expr = serialize_expression (postfragment, prop.get_accessor.value_type, new CCodeIdentifier ("result"));
 
 		postfragment.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("_reply"), reply_expr)));
 
-		if (requires_destroy (prop.property_type)) {
+		if (requires_destroy (prop.get_accessor.value_type)) {
 			// keep local alive (symbol_reference is weak)
 			// space before `result' is work around to not trigger
 			// variable renaming, we really mean C identifier `result' here
-			var local = new LocalVariable (prop.property_type, " result");
+			var local = new LocalVariable (prop.get_accessor.value_type, " result");
 			var ma = new MemberAccess.simple ("result");
 			ma.symbol_reference = local;
-			postfragment.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier ("result"), prop.property_type, ma)));
+			postfragment.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier ("result"), prop.get_accessor.value_type, ma)));
 		}
 
 		block.add_statement (postfragment);



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