[gnumeric] Fix consolidate tool. [#670155] & Fix crash on ODF import of messagefree validations.



commit 5762a5aee47330a13b6533c857c9812ebea10629
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu May 17 00:19:04 2012 -0600

    Fix consolidate tool. [#670155] & Fix crash on ODF import of messagefree validations.
    
    2012-05-17  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (odf_validation_new_list): check for empty
    	message
    	(odf_validation_new_single_expr): ditto
    	(odf_validation_new_pair_expr): ditto
    	(odf_validation_new_single_expr): ditto
    	(odf_validation_new_pair_expr): ditto
    
    2012-05-17  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-consolidate.c (adjust_source_areas): also expect empty
    	list stores
    	(add_source_area): do not add singletons
    	(dialog_consolidate_tool_init): even if the first selection range
    	is a singleton, there could be others that are not

 NEWS                                 |    2 ++
 plugins/openoffice/ChangeLog         |    9 +++++++++
 plugins/openoffice/openoffice-read.c |    6 +++---
 src/dialogs/ChangeLog                |    8 ++++++++
 src/dialogs/dialog-consolidate.c     |   19 +++++++++----------
 5 files changed, 31 insertions(+), 13 deletions(-)
---
diff --git a/NEWS b/NEWS
index 43cf962..c60f691 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ Andreas:
 	* Fix loading of line objects defined in ODF's shape section. [#676063]
 	* Add underline button to formatted text dialog for sheet objects, commemts, etc.
 	* Write the formatted text of sheet objects to ODF.
+	* Fix consolidate tool. [#670155]
+	* Fix crash on ODF import of messagefree validations.
 
 Jean:
 	* Fix graph series headers when a multiple selection is used. [#675913]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 23dbbc0..f380939 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,12 @@
+2012-05-17  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-read.c (odf_validation_new_list): check for empty
+	message
+	(odf_validation_new_single_expr): ditto
+	(odf_validation_new_pair_expr): ditto
+	(odf_validation_new_single_expr): ditto
+	(odf_validation_new_pair_expr): ditto
+
 2012-05-15  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* openoffice-write.c (odf_new_markup): handle NULL markup or text
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index c3068c1..6787d6e 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -2295,7 +2295,7 @@ odf_validation_new_list (GsfXMLIn *xin, odf_validation_t *val, guint offset)
 					     GNM_VALIDATION_OP_NONE,
 					     state->pos.sheet,
 					     val->title, 
-					     val->message->str,
+					     val->message ? val->message->str : NULL,
 					     texpr,
 					     NULL,
 					     val->allow_blank,
@@ -2344,7 +2344,7 @@ odf_validation_new_single_expr (GsfXMLIn *xin, odf_validation_t *val,
 				       val_op,
 				       state->pos.sheet,
 				       val->title, 
-				       val->message->str,
+				       val->message ? val->message->str : NULL,
 				       texpr,
 				       NULL,
 				       val->allow_blank,
@@ -2418,7 +2418,7 @@ odf_validation_new_pair_expr (GsfXMLIn *xin, odf_validation_t *val,
 				       val_op,
 				       state->pos.sheet,
 				       val->title, 
-				       val->message->str,
+				       val->message ? val->message->str : NULL,
 				       texpr_a,
 				       texpr_b,
 				       val->allow_blank,
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index a889c62..93929b2 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-17  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* dialog-consolidate.c (adjust_source_areas): also expect empty
+	list stores
+	(add_source_area): do not add singletons
+	(dialog_consolidate_tool_init): even if the first selection range
+	is a singleton, there could be others that are not
+
 2012-04-21  Morten Welinder <terra gnome org>
 
 	* Release 1.11.3
diff --git a/src/dialogs/dialog-consolidate.c b/src/dialogs/dialog-consolidate.c
index d86f9cc..f8862a1 100644
--- a/src/dialogs/dialog-consolidate.c
+++ b/src/dialogs/dialog-consolidate.c
@@ -107,10 +107,8 @@ adjust_source_areas (ConsolidateState *state)
 			g_free (source);
 		} while (gtk_tree_model_iter_next
 			 (state->source_areas,&iter));
-	} else {
-		g_warning ("Did not get a valid iterator");
-		return;
 	}
+		
 	for (i = 0; i < cnt_empty; i++) {
 		gtk_list_store_append (GTK_LIST_STORE(state->source_areas),
 				       &iter);
@@ -473,8 +471,13 @@ static gboolean
 add_source_area (SheetView *sv, GnmRange const *r, gpointer closure)
 {
 	ConsolidateState *state = closure;
-	char *range_name = global_range_name (sv_sheet (sv), r);
-	GtkTreeIter      iter;
+	char             *range_name;
+	GtkTreeIter       iter;
+
+	if (range_is_singleton (r))
+		return TRUE;
+
+	range_name = global_range_name (sv_sheet (sv), r);
 
 	gtk_list_store_prepend (GTK_LIST_STORE(state->source_areas),
 				&iter);
@@ -499,8 +502,6 @@ add_source_area (SheetView *sv, GnmRange const *r, gpointer closure)
 static void
 dialog_consolidate_tool_init (ConsolidateState *state)
 {
-	GnmRange const *r = NULL;
-
 	state->areas_index = -1;
 
 	setup_widgets (state, state->base.gui);
@@ -517,9 +518,7 @@ dialog_consolidate_tool_init (ConsolidateState *state)
 	 * When there are non-singleton selections add them all to the
 	 * source range list for convenience
 	 */
-	if ((r = selection_first_range (state->base.sv, NULL, NULL)) != NULL
-	    && !range_is_singleton (r))
-		sv_selection_foreach (state->base.sv, &add_source_area, state);
+	sv_selection_foreach (state->base.sv, &add_source_area, state);
 
 	adjust_source_areas (state);
 	dialog_set_button_sensitivity (NULL, state);



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