vala r843 - in trunk: . gobject



Author: juergbi
Date: Thu Jan 17 15:02:05 2008
New Revision: 843
URL: http://svn.gnome.org/viewvc/vala?rev=843&view=rev

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

	* gobject/valaccodegenerator.vala: pass non-simple structs also in
	  object creation expressions always by reference, fixes bug 510029


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

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Thu Jan 17 15:02:05 2008
@@ -2540,6 +2540,14 @@
 					ellipsis = param.ellipsis;
 					if (!param.ellipsis) {
 						cexpr = get_implicit_cast_expression (cexpr, arg.static_type, param.type_reference);
+
+						// pass non-simple struct instances always by reference
+						if (param.type_reference.data_type is Struct && !((Struct) param.type_reference.data_type).is_simple_type ()) {
+							// we already use a reference for arguments of ref and out parameters
+							if (!param.type_reference.is_ref && !param.type_reference.is_out) {
+								cexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, cexpr);
+							}
+						}
 					}
 				}
 			



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