[gnumeric] Sheet objects: fix critical on exit.



commit e9b6b3b146ebc27debafe48d65afdae1bacbc99c
Author: Morten Welinder <terra gnome org>
Date:   Mon Sep 28 13:02:00 2009 -0400

    Sheet objects: fix critical on exit.

 ChangeLog                 |    9 +++++++++
 NEWS                      |    1 +
 src/position.c            |    2 +-
 src/sheet-object-widget.c |    8 ++++----
 4 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 27eceac..fd17eff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-28  Morten Welinder  <terra gnome org>
+
+	* src/position.c (parse_pos_init_dep): Don't crash when dep's
+	sheet is NULL.  Whether callers expect such a GnmParsePos is a
+	different matter.
+
+	* src/sheet-object-widget.c (sax_write_dep): Use
+	parse_pos_init_dep, not parse_pos_init_sheet.  Fixes #596509.
+
 2009-09-27  Morten Welinder  <terra gnome org>
 
 	* src/sheet-object-widget.c: Simplify radio button stuff.
diff --git a/NEWS b/NEWS
index b236974..65ec85c 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ Morten:
 	* Fix translation problem with toolbar menu.  [#587250]
 	* Fix printing of coloured sheet objects.
 	* Fix printing of lines and arrows.
+	* Fix sheet object/clipboard related critical on exit.  [#596509]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.13
diff --git a/src/position.c b/src/position.c
index f05445f..a932560 100644
--- a/src/position.c
+++ b/src/position.c
@@ -182,7 +182,7 @@ parse_pos_init_dep (GnmParsePos *pp, GnmDependent const *dep)
 	g_return_val_if_fail (pp != NULL, NULL);
 
 	pp->sheet = dep->sheet;
-	pp->wb = dep->sheet->workbook;
+	pp->wb = dep->sheet ? dep->sheet->workbook : NULL;
 	if (dependent_is_cell (dep))
 		pp->eval = GNM_DEP_TO_CELL (dep)->pos;
 	else
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 4dc5e0d..c392ba3 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -218,10 +218,10 @@ sax_write_dep (GsfXMLOut *output, GnmDependent const *dep, char const *id,
 {
 	if (dep->texpr != NULL) {
 		GnmParsePos pos;
-		char *val = gnm_expr_top_as_string
-			(dep->texpr,
-			 parse_pos_init_sheet (&pos, dep->sheet),
-			 convs);
+		char *val;
+
+		parse_pos_init_dep (&pos, dep);
+		val = gnm_expr_top_as_string (dep->texpr, &pos, convs);
 		gsf_xml_out_add_cstr (output, id, val);
 		g_free (val);
 	}



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