Commit 5438251d authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

simplify dispose function, fixes bug 476700

2007-09-14  Juerg Billeter  <j@bitron.ch>

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

svn path=/trunk/; revision=604
parent 7383ea66
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,
......
......@@ -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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment