[gnumeric] Computation: Fix collect-pairs cache crash.



commit f47d68107362eaabdf9dab136ed618abc400d750
Author: Morten Welinder <terra gnome org>
Date:   Mon Sep 5 12:44:15 2011 -0400

    Computation: Fix collect-pairs cache crash.

 ChangeLog     |    5 +++++
 NEWS          |    3 +++
 src/collect.c |    7 +++++++
 3 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ef98ffb..856f2d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-05  Morten Welinder  <terra gnome org>
+
+	* src/collect.c (collect_float_pairs): Set return variables even
+	in the no-data case.  Fixes #658140.
+
 2011-09-04  Jean Brefort  <jean brefort normalesup org>
 
 	* src/sheet-object-widget.c (widget_wbc): fixed after goffice change.
diff --git a/NEWS b/NEWS
index b2a1666..d15a05b 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,9 @@ Jean:
 	* Fix row height autofit when zoom level is not 1. [#656418]
 	* Fix actions sensitivity for chart sheets. [#645842]
 
+Morten:
+	* Fix crash.  [#658140]
+
 Valek:
 	* In xls import, set LABEL encoding based on FONT charset converted to 
 	codepage. [#304007, ubuntu #262777]
diff --git a/src/collect.c b/src/collect.c
index 22fd562..d805be2 100644
--- a/src/collect.c
+++ b/src/collect.c
@@ -735,6 +735,9 @@ collect_float_pairs_ce (GnmValue const *vx, GnmValue const *vy,
  * @xs0: return location for first data vector
  * @xs1: return location for second data vector
  * @n: return location for number of data points
+ * @constp: optional return location for an indicator of the return vectors
+ * being owned by this function as opposed to the normal copy owned by the
+ * caller.
  *
  * If @n is not positive upon return, no data has been allocated.
  * If @n is negative upon return, the two ranges had different
@@ -802,6 +805,10 @@ collect_float_pairs (GnmValue const *vx, GnmValue const *vy,
 		if (ce->n <= 0) {
 			if (!use_cache)
 				pairs_floats_cache_entry_free (ce);
+			*xs0 = NULL;
+			*xs1 = NULL;
+			if (constp)
+				*constp = FALSE;
 			return NULL;
 		}
 		if (use_cache) {



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