[gob] Tue Dec 18 21:13:09 2012 Jiri (George) Lebl <jirka 5z com>



commit c2aee9a031aeafebe78c21accd1a4fd9ccb1f899
Author: Jiri (George) Lebl <jirka 5z com>
Date:   Tue Dec 18 21:13:14 2012 -0600

    Tue Dec 18 21:13:09 2012  Jiri (George) Lebl <jirka 5z com>
    
    	* Release 2.0.19
    
    Tue Dec 18 21:08:09 2012  Jiri (George) Lebl <jirka 5z com>
    
    	* src/main.c: print unreftors and destructors before calling dispose
    	  or finalize as is the proper ordering.  Thanks to Dmitri Toubelis
    	  for pointing it out.

 ChangeLog    |   10 +++++++
 NEWS         |    6 ++++
 configure.in |    7 +++--
 src/main.c   |   78 ++++++++++++++++++++++++++++++++++++---------------------
 4 files changed, 69 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b52dcf6..e12228e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Dec 18 21:13:09 2012  Jiri (George) Lebl <jirka 5z com>
+
+	* Release 2.0.19
+
+Tue Dec 18 21:08:09 2012  Jiri (George) Lebl <jirka 5z com>
+
+	* src/main.c: print unreftors and destructors before calling dispose
+	  or finalize as is the proper ordering.  Thanks to Dmitri Toubelis
+	  for pointing it out.
+
 Tue Dec 18 20:55:58 2012  Jiri (George) Lebl <jirka 5z com>
 
 	* src/main.c: apply patch from Nick Bowler to not output
diff --git a/NEWS b/NEWS
index 30e01ad..77fe3e3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+2.0.19:
+	* Print unreftors and destructors before calling parent finalize and
+	  dispose as is the proper ordering (thanks to Dmitri Toubelis)
+	* do not output #line 0 statements (patch from Nick Bowler)
+	* Fix empty file separator (thanks to H.-J. Schnitzer)
+
 2.0.18:
 	* Add %ctop{ %} to do what alltop does but only for the C file
 	* Buildfixes for Cygwin (Roland Clobus)
diff --git a/configure.in b/configure.in
index adfc645..d5efb44 100644
--- a/configure.in
+++ b/configure.in
@@ -1,8 +1,9 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.2)
-AC_INIT(src/treefuncs.h)
+AC_INIT([gob2], [2.0.19])
+AC_CONFIG_SRCDIR([src/treefuncs.h])
+AM_INIT_AUTOMAKE([dist-xz])
+
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(gob2,2.0.18)
 AM_MAINTAINER_MODE
 
 GLIB_REQUIRED=2.0.0
diff --git a/src/main.c b/src/main.c
index 12ea146..b4d1b27 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2166,7 +2166,7 @@ print_destructor (Variable *v)
 
 		if(v->destructor_line > 0)
 			out_addline_outfile(out);
-		out_printf(out, "\tmemset(&%s, 0, sizeof(%s));\n",
+		out_printf(out, "\tmemset(&(%s), 0, sizeof(%s));\n",
 			   v->id, v->id);
 		out_printf(out, "#undef VAR\n");
 		out_printf(out, "#undef %s\n", v->id);
@@ -2201,6 +2201,22 @@ add_constructor (Class *c)
 }
 
 static void
+print_unreftors (Class *c)
+{
+	GList *li;
+	for(li = ((Class *)class)->nodes;
+	    li != NULL;
+	    li = li->next) {
+		Node *n = li->data;
+		Variable *v = (Variable *)n;
+		if (n->type == VARIABLE_NODE &&
+		    v->scope != CLASS_SCOPE &&
+		    v->destructor_unref)
+			print_destructor (v);
+	}
+}
+
+static void
 add_dispose (Class *c)
 {
 	out_printf(out, "\nstatic void\n"
@@ -2218,6 +2234,10 @@ add_dispose (Class *c)
 	}
 
 	if (dispose_handler != NULL) {
+		if (unreftors > 0) {
+			print_unreftors (c);
+		}
+
 		/* so we get possible bad argument warning */
 		if (dispose_handler->line_no > 0)
 			out_addline_infile (out, dispose_handler->line_no);
@@ -2234,30 +2254,36 @@ add_dispose (Class *c)
 				out_addline_outfile (out);
 		}
 
+		if (unreftors > 0) {
+			print_unreftors (c);
+		}
+
 		out_printf (out,
 			    "\tif (G_OBJECT_CLASS (parent_class)->dispose) \\\n"
 			    "\t\t(* G_OBJECT_CLASS (parent_class)->dispose) (obj_self);\n");
 	}
 
-	if (unreftors > 0) {
-		GList *li;
-		for(li = ((Class *)class)->nodes;
-		    li != NULL;
-		    li = li->next) {
-			Node *n = li->data;
-			Variable *v = (Variable *)n;
-			if (n->type == VARIABLE_NODE &&
-			    v->scope != CLASS_SCOPE &&
-			    v->destructor_unref)
-				print_destructor (v);
-		}
-	}
-
 	out_printf(out, "}\n"
 		   "#undef __GOB_FUNCTION__\n\n");
 }
 
 static void
+print_destructors (Class *c)
+{
+	GList *li;
+	for (li = ((Class *)class)->nodes;
+	     li != NULL;
+	     li = li->next) {
+		Node *n = li->data;
+		Variable *v = (Variable *)n;
+		if (n->type == VARIABLE_NODE &&
+		    v->scope != CLASS_SCOPE &&
+		    ! v->destructor_unref)
+			print_destructor (v);
+	}
+}
+
+static void
 add_finalize (Class *c)
 {
 	out_printf(out,
@@ -2286,6 +2312,10 @@ add_finalize (Class *c)
 	}
 
 	if(finalize_handler) {
+		if (destructors > 0) {
+			print_destructors (c);
+		}
+
 		/* so we get possible bad argument warning */
 		if(finalize_handler->line_no > 0)
 			out_addline_infile(out, finalize_handler->line_no);
@@ -2302,25 +2332,15 @@ add_finalize (Class *c)
 				out_addline_outfile (out);
 		}
 
+		if (destructors > 0) {
+			print_destructors (c);
+		}
+
 		out_printf(out,
 			   "\tif(G_OBJECT_CLASS(parent_class)->finalize) \\\n"
 			   "\t\t(* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);\n");
 	}
 
-	if (destructors > 0) {
-		GList *li;
-		for (li = ((Class *)class)->nodes;
-		     li != NULL;
-		     li = li->next) {
-			Node *n = li->data;
-			Variable *v = (Variable *)n;
-			if (n->type == VARIABLE_NODE &&
-			    v->scope != CLASS_SCOPE &&
-			    ! v->destructor_unref)
-				print_destructor (v);
-		}
-	}
-
 	out_printf(out, "}\n"
 		   "#undef __GOB_FUNCTION__\n\n");
 }



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