fix error handling in static constructors, fixes bug 528111
authorJuerg Billeter <j@bitron.ch>
Wed, 16 Apr 2008 21:05:06 +0000 (21:05 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 16 Apr 2008 21:05:06 +0000 (21:05 +0000)
2008-04-16  Juerg Billeter  <j@bitron.ch>

* gobject/valaccodegenerator.vala: fix error handling in static
  constructors, fixes bug 528111

svn path=/trunk/; revision=1249

ChangeLog
gobject/valaccodegenerator.vala

index f3d4663..7bdf63a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-04-16  Jürg Billeter  <j@bitron.ch>
 
+       * gobject/valaccodegenerator.vala: fix error handling in static
+         constructors, fixes bug 528111
+
+2008-04-16  Jürg Billeter  <j@bitron.ch>
+
        * vapi/dbus-glib-1.vapi: fix dbus_connection_setup_with_g_main binding
 
 2008-04-16  Jürg Billeter  <j@bitron.ch>
index 654af43..f9da4d4 100644 (file)
@@ -983,6 +983,16 @@ public class Vala.CCodeGenerator : CodeGenerator {
                } else {
                        // static class constructor
                        // add to class_init
+
+                       if (current_method_inner_error) {
+                               /* always separate error parameter and inner_error local variable
+                                * as error may be set to NULL but we're always interested in inner errors
+                                */
+                               var cdecl = new CCodeDeclaration ("GError *");
+                               cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+                               class_init_fragment.append (cdecl);
+                       }
+
                        class_init_fragment.append (c.body.ccodenode);
                }
        }