From: Jürg Billeter Date: Fri, 9 Jan 2009 23:09:11 +0000 (+0000) Subject: Fix critical and generated code for static delegate fields, fixes bug X-Git-Tag: VALA_0_5_5~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46cbf6440f636a4addd0e0dccb3ca280b36d39e5;p=thirdparty%2Fvala.git Fix critical and generated code for static delegate fields, fixes bug 2009-01-10 Jürg Billeter * gobject/valaccodebasemodule.vala: * gobject/valaccodedelegatemodule.vala: Fix critical and generated code for static delegate fields, fixes bug 563016 svn path=/trunk/; revision=2316 --- diff --git a/ChangeLog b/ChangeLog index 892604af0..d5a963eb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-01-10 Jürg Billeter + + * gobject/valaccodebasemodule.vala: + * gobject/valaccodedelegatemodule.vala: + + Fix critical and generated code for static delegate fields, + fixes bug 563016 + 2009-01-10 Jürg Billeter * vala/valafield.vala: diff --git a/gobject/valaccodebasemodule.vala b/gobject/valaccodebasemodule.vala index 2cb23a7f9..2eb738a14 100644 --- a/gobject/valaccodebasemodule.vala +++ b/gobject/valaccodebasemodule.vala @@ -3581,7 +3581,8 @@ public class Vala.CCodeBaseModule : CCodeModule { } public CCodeExpression? default_value_for_type (DataType type, bool initializer_expression) { - if ((type.data_type != null && type.data_type.is_reference_type ()) || type is PointerType || type is ArrayType) { + if ((type.data_type != null && type.data_type.is_reference_type ()) + || type is PointerType || type is ArrayType || type is DelegateType) { return new CCodeConstant ("NULL"); } else if (type.data_type != null && type.data_type.get_default_value () != null) { return new CCodeConstant (type.data_type.get_default_value ()); diff --git a/gobject/valaccodedelegatemodule.vala b/gobject/valaccodedelegatemodule.vala index ecdaedb9a..db18d0092 100644 --- a/gobject/valaccodedelegatemodule.vala +++ b/gobject/valaccodedelegatemodule.vala @@ -1,6 +1,7 @@ /* valaccodedelegatemodule.vala * - * Copyright (C) 2006-2008 Jürg Billeter, Raffaele Sandrini + * Copyright (C) 2006-2009 Jürg Billeter + * Copyright (C) 2006-2008 Raffaele Sandrini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -123,14 +124,13 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule { var ma = (MemberAccess) delegate_expr; - var base_type = ma.inner.value_type; CCodeExpression target_expr = null; - var pub_inst = (CCodeExpression) get_ccodenode (ma.inner); - if (field.binding == MemberBinding.INSTANCE) { - var instance_expression_type = base_type; + var instance_expression_type = ma.inner.value_type; var instance_target_type = get_data_type_for_symbol ((TypeSymbol) field.parent_symbol); + + var pub_inst = (CCodeExpression) get_ccodenode (ma.inner); CCodeExpression typed_inst = transform_expression (pub_inst, instance_expression_type, instance_target_type); CCodeExpression inst;