From: Mathias Hasselmann Date: Tue, 28 Aug 2007 15:17:45 +0000 (+0000) Subject: avoid crash on missing copy function, fixes bug 471063. X-Git-Tag: VALA_0_1_3~35 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77edd1784de9afda7caeb2d01548c336cbf07341;p=thirdparty%2Fvala.git avoid crash on missing copy function, fixes bug 471063. 2007-08-28 Mathias Hasselmann * gobject/valacodegenerator.vala: avoid crash on missing copy function, fixes bug 471063. svn path=/trunk/; revision=520 --- diff --git a/ChangeLog b/ChangeLog index f7f55059b..2ac0b3db1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-08-28 Mathias Hasselmann + + * gobject/valacodegenerator.vala: avoid crash on missing copy + function, fixes bug 471063. + 2007-08-28 Marc-Andre Lureau * doc/Makefile.am, doc/gidlgen.1, doc/vapigen.1: diff --git a/gobject/valacodegenerator.vala b/gobject/valacodegenerator.vala index ef6f46270..17067a8b3 100644 --- a/gobject/valacodegenerator.vala +++ b/gobject/valacodegenerator.vala @@ -955,7 +955,11 @@ public class Vala.CodeGenerator : CodeVisitor { Report.error (type.data_type.source_reference, "The type `%s` doesn't contain a copy function".printf (type.data_type.get_full_name ())); } } - return new CCodeIdentifier (dup_function); + + if (null != dup_function) + return new CCodeIdentifier (dup_function); + + return null; } else if (type.type_parameter != null && current_type_symbol is Class) { string func_name = "%s_dup_func".printf (type.type_parameter.name.down ()); return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), func_name); @@ -2245,7 +2249,13 @@ public class Vala.CodeGenerator : CodeVisitor { * if static type of expr is non-null */ - var ccall = new CCodeFunctionCall (get_dup_func_expression (expr.static_type)); + var dupexpr = get_dup_func_expression (expr.static_type); + + if (null == dupexpr) { + return null; + } + + var ccall = new CCodeFunctionCall (dupexpr); if (expr.static_type.non_null && expr.static_type.type_parameter == null) { ccall.add_argument ((CCodeExpression) expr.ccodenode);