From: Jürg Billeter Date: Mon, 13 Sep 2010 17:26:30 +0000 (+0200) Subject: codegen: Fix missing _inner_error_ declaration in destructors X-Git-Tag: 0.11.0~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6f4f15ff305c54bccb6fcda04a942904fd66267;p=thirdparty%2Fvala.git codegen: Fix missing _inner_error_ declaration in destructors Fixes bug 629366. --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index d6da08618..f85a3ed25 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -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"))); } }