vala r2313 - in trunk: . gobject
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2313 - in trunk: . gobject
- Date: Fri, 9 Jan 2009 22:35:51 +0000 (UTC)
Author: juergbi
Date: Fri Jan 9 22:35:51 2009
New Revision: 2313
URL: http://svn.gnome.org/viewvc/vala?rev=2313&view=rev
Log:
2009-01-09 JÃrg Billeter <j bitron ch>
* gobject/valaccodememberaccessmodule.vala:
Do not free values returned via g_object_get prematurely, require
properties without accessor methods to return an owned value,
fixes bug 559644
Modified:
trunk/ChangeLog
trunk/gobject/valaccodememberaccessmodule.vala
Modified: trunk/gobject/valaccodememberaccessmodule.vala
==============================================================================
--- trunk/gobject/valaccodememberaccessmodule.vala (original)
+++ trunk/gobject/valaccodememberaccessmodule.vala Fri Jan 9 22:35:51 2009
@@ -202,8 +202,8 @@
ccall.add_argument (pub_inst);
}
- // Property acesses to real struct types are handeled different to other properties.
- // They are returned as out parameter.
+ // Property access to real struct types is handled differently
+ // The value is returned by out parameter
if (base_property.property_type.is_real_struct_type ()) {
var ccomma = new CCodeCommaExpression ();
var temp_var = get_temp_variable (base_property.property_type);
@@ -218,33 +218,21 @@
}
} else {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_get"));
-
- var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT"));
- ccast.add_argument (pub_inst);
- ccall.add_argument (ccast);
+ ccall.add_argument (pub_inst);
// property name is second argument of g_object_get
ccall.add_argument (prop.get_canonical_cconstant ());
// g_object_get always returns owned values
- var temp_type = expr.value_type.copy ();
- temp_type.value_owned = true;
+ // therefore, property getters of properties
+ // without accessor methods need to be marked as owned
- // we need a temporary variable to save the property value
+ var ccomma = new CCodeCommaExpression ();
var temp_var = get_temp_variable (expr.value_type);
- temp_vars.insert (0, temp_var);
-
- if (requires_destroy (temp_type)) {
- temp_ref_vars.insert (0, temp_var);
- }
-
var ctemp = new CCodeIdentifier (temp_var.name);
+ temp_vars.add (temp_var);
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ctemp));
-
-
ccall.add_argument (new CCodeConstant ("NULL"));
-
- var ccomma = new CCodeCommaExpression ();
ccomma.append_expression (ccall);
ccomma.append_expression (ctemp);
expr.ccodenode = ccomma;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]