vala r1200 - in trunk: . gobject vala



Author: juergbi
Date: Sun Apr 13 12:52:43 2008
New Revision: 1200
URL: http://svn.gnome.org/viewvc/vala?rev=1200&view=rev

Log:
2008-04-13  Juerg Billeter  <j bitron ch>

	* vala/valaerrortype.vala: implement get_type_id

	* gobject/valaccodeassignmentbinding.vala: don't crash when using
	  unsupported parameter types in D-Bus signal handlers

	Fixes bug 527027


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodeassignmentbinding.vala
   trunk/vala/valaerrortype.vala

Modified: trunk/gobject/valaccodeassignmentbinding.vala
==============================================================================
--- trunk/gobject/valaccodeassignmentbinding.vala	(original)
+++ trunk/gobject/valaccodeassignmentbinding.vala	Sun Apr 13 12:52:43 2008
@@ -281,12 +281,22 @@
 				}
 				if (param.type_reference is ArrayType && ((ArrayType) param.type_reference).element_type.data_type != codegen.string_type.data_type) {
 					var array_type = (ArrayType) param.type_reference;
+					if (array_type.element_type.data_type.get_type_id () == null) {
+						Report.error (param.source_reference, "unsupported parameter type for D-Bus signals");
+						return;
+					}
+
 					var carray_type = new CCodeFunctionCall (new CCodeIdentifier ("dbus_g_type_get_collection"));
 					carray_type.add_argument (new CCodeConstant ("\"GArray\""));
 					carray_type.add_argument (new CCodeIdentifier (array_type.element_type.data_type.get_type_id ()));
 					register_call.add_argument (carray_type);
 					add_call.add_argument (carray_type);
 				} else {
+					if (param.type_reference.get_type_id () == null) {
+						Report.error (param.source_reference, "unsupported parameter type for D-Bus signals");
+						return;
+					}
+
 					register_call.add_argument (new CCodeIdentifier (param.type_reference.get_type_id ()));
 					add_call.add_argument (new CCodeIdentifier (param.type_reference.get_type_id ()));
 				}

Modified: trunk/vala/valaerrortype.vala
==============================================================================
--- trunk/vala/valaerrortype.vala	(original)
+++ trunk/vala/valaerrortype.vala	Sun Apr 13 12:52:43 2008
@@ -98,4 +98,8 @@
 		var gerror_symbol = root_symbol.scope.lookup ("GLib").scope.lookup ("Error");
 		return gerror_symbol.scope.lookup (member_name);
 	}
+
+	public override string? get_type_id () {
+		return "G_TYPE_POINTER";
+	}
 }



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