[vala/staging: 57/67] dbus: Copy type when declaring temporary variables



commit 75abd399887ac7780907e4c36b70a3f8c1237abc
Author: Luca Bruno <lucabru src gnome org>
Date:   Fri Oct 26 13:46:42 2012 +0200

    dbus: Copy type when declaring temporary variables
    
    If type is not copied, then the semantic analyzer will modify the
    original type.

 codegen/valagdbusservertransformer.vala |    2 +-
 tests/dbus/dicts.test                   |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagdbusservertransformer.vala b/codegen/valagdbusservertransformer.vala
index 9b1ae5a..bdfd631 100644
--- a/codegen/valagdbusservertransformer.vala
+++ b/codegen/valagdbusservertransformer.vala
@@ -106,7 +106,7 @@ public class Vala.GDBusServerTransformer : GDBusClientTransformer {
 		b.open_try ();
 		string result = null;
 		if (m.has_result) {
-			result = b.add_temp_declaration (m.return_type);
+			result = b.add_temp_declaration (copy_type (m.return_type));
 			b.add_assignment (expression (result), finish_call);
 		} else {
 			b.add_expression (finish_call);
diff --git a/tests/dbus/dicts.test b/tests/dbus/dicts.test
index c67c515..1e7037e 100644
--- a/tests/dbus/dicts.test
+++ b/tests/dbus/dicts.test
@@ -32,6 +32,19 @@ class Test : Object {
 	}
 }
 
+namespace TestInterface {
+	[DBus (name = "org.vala.Test.Bar")]
+	public interface Bar : GLib.Object {
+		public abstract HashTable<string, Variant> foo () throws IOError;
+	}
+
+	public class Foo : GLib.DBusProxy, Bar {
+		public HashTable<string, Variant> foo () throws IOError {
+			return new HashTable<string, Variant> (str_hash, str_equal);
+		}
+	}
+}
+
 MainLoop main_loop;
 
 void client_exit (Pid pid, int status) {



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