vala r907 - in trunk: . gobject



Author: juergbi
Date: Sat Jan 26 10:29:08 2008
New Revision: 907
URL: http://svn.gnome.org/viewvc/vala?rev=907&view=rev

Log:
2008-01-26  Juerg Billeter  <j bitron ch>

	* gobject/valaccodegenerator.vala: fix crash when using type without
	  copy function, fixes bug 511821


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Sat Jan 26 10:29:08 2008
@@ -2570,7 +2570,13 @@
 				foreach (DataType type_arg in expr.type_reference.get_type_arguments ()) {
 					creation_call.add_argument (get_type_id_expression (type_arg));
 					if (type_arg.takes_ownership) {
-						creation_call.add_argument (new CCodeCastExpression (get_dup_func_expression (type_arg), "GBoxedCopyFunc"));
+						var dup_func = get_dup_func_expression (type_arg);
+						if (dup_func == null) {
+							// type doesn't contain a copy function
+							expr.error = true;
+							return;
+						}
+						creation_call.add_argument (new CCodeCastExpression (dup_func, "GBoxedCopyFunc"));
 						creation_call.add_argument (get_destroy_func_expression (type_arg));
 					} else {
 						creation_call.add_argument (new CCodeConstant ("NULL"));



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