simplify dispose function, fixes bug 476700
authorJuerg Billeter <j@bitron.ch>
Fri, 14 Sep 2007 20:45:31 +0000 (20:45 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 14 Sep 2007 20:45:31 +0000 (20:45 +0000)
2007-09-14  Juerg Billeter  <j@bitron.ch>

* gobject/valacodegeneratorclass.vala: simplify dispose function,
  fixes bug 476700

svn path=/trunk/; revision=604

ChangeLog
gobject/valacodegeneratorclass.vala

index c1b7ed1..bbf2746 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2007-09-14  Jürg Billeter  <j@bitron.ch>
 
+       * gobject/valacodegeneratorclass.vala: simplify dispose function,
+         fixes bug 476700
+
+2007-09-14  Jürg Billeter  <j@bitron.ch>
+
        * gobject/valacodegeneratorinvocationexpression.vala,
          gobject/valacodegeneratorsignal.vala: fix late bound methods and
          signals, fixes bug 476953
index 247ae2f..c743e68 100644 (file)
@@ -427,29 +427,10 @@ public class Vala.CodeGenerator {
 
                cblock.add_statement (instance_dispose_fragment);
 
-               cdecl = new CCodeDeclaration ("%sClass *".printf (cl.get_cname ()));
-               cdecl.add_declarator (new CCodeVariableDeclarator ("klass"));
-               cblock.add_statement (cdecl);
-
-               cdecl = new CCodeDeclaration ("GObjectClass *");
-               cdecl.add_declarator (new CCodeVariableDeclarator ("parent_class"));
-               cblock.add_statement (cdecl);
-
-
-               ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_peek"));
-               ccall.add_argument (new CCodeIdentifier (cl.get_upper_case_cname ("TYPE_")));
-               var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (cl.get_upper_case_cname (null))));
-               ccast.add_argument (ccall);
-               cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("klass"), ccast)));
-
-               ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_peek_parent"));
-               ccall.add_argument (new CCodeIdentifier ("klass"));
-               ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
-               ccast.add_argument (ccall);
-               cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("parent_class"), ccast)));
-
-               
-               ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (new CCodeIdentifier ("parent_class"), "dispose"));
+               // chain up to dispose function of the base class
+               var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
+               ccast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (cl.get_lower_case_cname (null))));
+               ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (ccast, "dispose"));
                ccall.add_argument (new CCodeIdentifier ("obj"));
                cblock.add_statement (new CCodeExpressionStatement (ccall));