Commit dbac5ee5 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

support class destructors

2007-07-26  Juerg Billeter  <j@bitron.ch>

	* gobject/valacodegeneratorclass.vala, vapi/glib-2.0.vala: support
	  class destructors

svn path=/trunk/; revision=392
parent a98c980b
2007-07-26 Jürg Billeter <j@bitron.ch>
* gobject/valacodegeneratorclass.vala, vapi/glib-2.0.vala: support
class destructors
2007-07-26 Jürg Billeter <j@bitron.ch>
* gobject/valacodegenerator.vala,
......
......@@ -122,7 +122,7 @@ public class Vala.CodeGenerator {
}
add_instance_init_function (cl);
if (memory_management && cl.get_fields () != null) {
if ((memory_management && cl.get_fields () != null) || cl.destructor != null) {
add_dispose_function (cl);
}
......@@ -145,7 +145,6 @@ public class Vala.CodeGenerator {
current_type_symbol = old_type_symbol;
current_class = old_class;
instance_dispose_fragment = old_instance_dispose_fragment;
instance_struct = old_instance_struct;
type_struct = old_type_struct;
instance_priv_struct = old_instance_priv_struct;
......@@ -375,7 +374,11 @@ public class Vala.CodeGenerator {
cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
cblock.add_statement (cdecl);
if (cl.destructor != null) {
cblock.add_statement ((CCodeBlock) cl.destructor.body.ccodenode);
}
cblock.add_statement (instance_dispose_fragment);
cdecl = new CCodeDeclaration ("%sClass *".printf (cl.get_cname ()));
......
......@@ -614,6 +614,9 @@ namespace GLib {
public void unref ();
public Object ref_sink ();
public void set (...);
public virtual void dispose ();
public virtual void finalize ();
public virtual void constructed ();
}
public class InitiallyUnowned : Object {
......
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