gnumeric r16428 - in trunk: . src



Author: mortenw
Date: Sat Mar  1 17:40:17 2008
New Revision: 16428
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16428&view=rev

Log:
2008-03-01  Morten Welinder  <terra gnome org>

	* src/xml-sax-read.c (xml_sax_cell_content): Ref shared
	expressions before inserting them into the hash.
	(gnm_xml_file_open): Register a value-free function for the shared
	expression hash.  Fixes #519761.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/src/xml-sax-read.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sat Mar  1 17:40:17 2008
@@ -42,6 +42,7 @@
 	* Fix memory allocation failure for huge .gnumeric files.  [#519319]
 	* Fix mstyle problem.  [#519451]
 	* Fix auto-fill problem.  [#519680]
+	* Fix corrupted-gnumeric-bug.  [#519761]
 
 --------------------------------------------------------------------------
 Gnumeric 1.8.0

Modified: trunk/src/xml-sax-read.c
==============================================================================
--- trunk/src/xml-sax-read.c	(original)
+++ trunk/src/xml-sax-read.c	Sat Mar  1 17:40:17 2008
@@ -1616,7 +1616,7 @@
 			GNM_STYLE_BORDER_TOP + (int)(type - MSTYLE_BORDER_TOP);
 		GnmBorder *border =
 			gnm_style_border_fetch ((GnmStyleBorderType)pattern, colour,
-					    gnm_style_border_get_orientation (loc));
+						gnm_style_border_get_orientation (loc));
 		gnm_style_set_border (state->style, type, border);
 	}
 }
@@ -1830,10 +1830,14 @@
 			GnmExprTop const *texpr =
 				g_hash_table_lookup (state->expr_map, id);
 			if (texpr == NULL) {
-				if (gnm_cell_has_expr (cell))
-					g_hash_table_insert (state->expr_map, id,
-							     (gpointer)cell->base.texpr);
-				else
+				if (gnm_cell_has_expr (cell)) {
+					GnmExprTop const *texpr =
+						cell->base.texpr;
+					gnm_expr_top_ref (texpr);
+					g_hash_table_insert (state->expr_map,
+							     id,
+							     (gpointer)texpr);
+				} else
 					g_warning ("XML-IO : Shared expression with no expression ??");
 			} else if (!is_post_52_array)
 				g_warning ("XML-IO : Duplicate shared expression");
@@ -2591,7 +2595,9 @@
 	state.validation.texpr[0] = state.validation.texpr[1] = NULL;
 	state.cond.texpr[0] = state.cond.texpr[1] = NULL;
 	state.cond_save_style = NULL;
-	state.expr_map = g_hash_table_new (g_direct_hash, g_direct_equal);
+	state.expr_map = g_hash_table_new_full
+		(g_direct_hash, g_direct_equal,
+		 NULL, (GFreeFunc)gnm_expr_top_unref);
 	state.delayed_names = NULL;
 	state.so = NULL;
 	state.page_breaks = NULL;



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