]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix uninitialized variable in constructors throwing errors
authorJürg Billeter <j@bitron.ch>
Fri, 8 Oct 2010 18:23:21 +0000 (20:23 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 8 Oct 2010 18:23:21 +0000 (20:23 +0200)
codegen/valaccodemethodmodule.vala

index 89d216f2b19f41bdb94a55e27c5cca2079409854..7d850a9429c7d51037b75990cd3f3cb5a9b4a93c 100644 (file)
@@ -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"));