vala r1642 - in trunk: . gobject



Author: juergbi
Date: Mon Jun 23 20:36:38 2008
New Revision: 1642
URL: http://svn.gnome.org/viewvc/vala?rev=1642&view=rev

Log:
2008-06-23  JÃrg Billeter  <j bitron ch>

	* gobject/valaccodeclassbinding.vala:
	* gobject/valaccodegenerator.vala:

	Fix exception handling in destructors, fixes bug 538216


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodeclassbinding.vala
   trunk/gobject/valaccodegenerator.vala

Modified: trunk/gobject/valaccodeclassbinding.vala
==============================================================================
--- trunk/gobject/valaccodeclassbinding.vala	(original)
+++ trunk/gobject/valaccodeclassbinding.vala	Mon Jun 23 20:36:38 2008
@@ -270,7 +270,7 @@
 			cblock.add_statement (codegen.instance_dispose_fragment);
 
 			if (cl.destructor != null) {
-				cblock.add_statement (cl.destructor.body.ccodenode);
+				cblock.add_statement (cl.destructor.ccodenode);
 			}
 
 			var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_slice_free"));
@@ -593,7 +593,7 @@
 		cblock.add_statement (cdecl);
 
 		if (cl.destructor != null) {
-			cblock.add_statement ((CCodeBlock) cl.destructor.body.ccodenode);
+			cblock.add_statement (cl.destructor.ccodenode);
 		}
 
 		cblock.add_statement (codegen.instance_dispose_fragment);

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Mon Jun 23 20:36:38 2008
@@ -1070,7 +1070,21 @@
 	}
 
 	public override void visit_destructor (Destructor d) {
+		current_method_inner_error = false;
+
 		d.accept_children (this);
+
+		CCodeFragment cfrag = new CCodeFragment ();
+
+		if (current_method_inner_error) {
+			var cdecl = new CCodeDeclaration ("GError *");
+			cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+			cfrag.append (cdecl);
+		}
+
+		cfrag.append (d.body.ccodenode);
+
+		d.ccodenode = cfrag;
 	}
 
 	public override void visit_block (Block b) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]