[gnumeric] Editing: fix critical when overwritiin array formula. [#584746]



commit 804d385f566c8e5d3630bf342addc2d22076079f
Author: Morten Welinder <terra gnome org>
Date:   Thu Jun 4 09:18:02 2009 -0400

    Editing: fix critical when overwritiin array formula.  [#584746]
---
 ChangeLog   |    5 +++++
 NEWS        |    1 +
 src/sheet.c |   13 +++++++++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f4bba32..84f057e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-04  Morten Welinder  <terra gnome org>
+
+	* src/sheet.c (cb_set_cell_content): Fix critical when overwriting
+	a non-singular array formula with non-array contents.  [#584746]
+
 2009-06-03  Morten Welinder  <terra gnome org>
 
 	* src/expr.c (cellref_boundingbox, gnm_expr_get_boundingbox,
diff --git a/NEWS b/NEWS
index 8d9d40b..277b353 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Morten:
 	* Fix format-as-currency action.
 	* Honour --geometry even when not loading a file.
 	* Fix increase/decrease precision for accounting formats.
+	* Fix array editing criticals.  [#584746]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.8
diff --git a/src/sheet.c b/src/sheet.c
index 3316994..bfc01f6 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -2332,9 +2332,18 @@ cb_set_cell_content (GnmCellIter const *iter, closure_set_cell_value *info)
 	GnmExprTop const *texpr = info->texpr;
 	GnmCell *cell;
 
-	if (NULL == (cell = iter->cell))
+	cell = iter->cell;
+	if (!cell)
 		cell = sheet_cell_create (iter->pp.sheet,
-			iter->pp.eval.col, iter->pp.eval.row);
+					  iter->pp.eval.col,
+					  iter->pp.eval.row);
+
+	/*
+	 * If we are overwriting an array, we need to clear things here
+	 * or gnm_cell_set_expr/gnm_cell_set_value will complain.
+	 */
+	if (cell->base.texpr && gnm_expr_top_is_array (cell->base.texpr))
+		gnm_cell_cleanout (cell);
 
 	if (texpr != NULL) {
 		if (!range_contains (&info->expr_bound,



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