From: Jürg Billeter Date: Fri, 8 Oct 2010 18:23:21 +0000 (+0200) Subject: codegen: Fix uninitialized variable in constructors throwing errors X-Git-Tag: 0.11.1~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=835ebab7dbac51dd11b53d71caf1c7b2aded78c8;p=thirdparty%2Fvala.git codegen: Fix uninitialized variable in constructors throwing errors --- diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala index 89d216f2b..7d850a942 100644 --- a/codegen/valaccodemethodmodule.vala +++ b/codegen/valaccodemethodmodule.vala @@ -478,10 +478,10 @@ public class Vala.CCodeMethodModule : CCodeStructModule { if (m is CreationMethod) { if (in_gobject_creation_method) { - ccode.add_declaration ("%s *".printf (((Class) current_type_symbol).get_cname ()), new CCodeVariableDeclarator ("self")); + ccode.add_declaration ("%s *".printf (((Class) current_type_symbol).get_cname ()), new CCodeVariableDeclarator.zero ("self", new CCodeConstant ("NULL"))); } else if (is_gtypeinstance_creation_method (m)) { var cl = (Class) m.parent_symbol; - ccode.add_declaration (cl.get_cname () + "*", new CCodeVariableDeclarator ("self")); + ccode.add_declaration (cl.get_cname () + "*", new CCodeVariableDeclarator.zero ("self", new CCodeConstant ("NULL"))); if (cl.is_fundamental ()) { var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_create_instance"));