]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix missing _inner_error_ declaration in destructors
authorJürg Billeter <j@bitron.ch>
Mon, 13 Sep 2010 17:26:30 +0000 (19:26 +0200)
committerJürg Billeter <j@bitron.ch>
Mon, 13 Sep 2010 17:41:46 +0000 (19:41 +0200)
Fixes bug 629366.

codegen/valagtypemodule.vala

index d6da086183f317ef68a19a123dcbff4a1ad9296d..f85a3ed2546b4e17216a76d735db642ee4af6431 100644 (file)
@@ -1636,10 +1636,6 @@ public class Vala.GTypeModule : GErrorModule {
 
                        ccode.add_declaration ("%s *".printf (cl.get_cname ()), new CCodeVariableDeclarator ("self"));
                        ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), ccall));
-
-                       if (cl.destructor != null) {
-                               cl.destructor.body.emit (this);
-                       }
                } else {
                        var function = new CCodeFunction (cl.get_lower_case_cprefix () + "free", "void");
                        if (cl.access == SymbolAccessibility.PRIVATE) {
@@ -1649,9 +1645,13 @@ public class Vala.GTypeModule : GErrorModule {
                        function.add_parameter (new CCodeFormalParameter ("self", cl.get_cname () + "*"));
 
                        push_function (function);
+               }
+
+               if (cl.destructor != null) {
+                       cl.destructor.body.emit (this);
 
-                       if (cl.destructor != null) {
-                               cl.destructor.body.emit (this);
+                       if (current_method_inner_error) {
+                               ccode.add_declaration ("GError *", new CCodeVariableDeclarator.zero ("_inner_error_", new CCodeConstant ("NULL")));
                        }
                }