[goffice] Fix crashes in probability and scatter plots.



commit a8962aa66f3f92f077ede6e3dece92845220a5ed
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Nov 26 11:40:11 2009 +0100

    Fix crashes in probability and scatter plots.

 ChangeLog                                   |    9 ++++++++
 NEWS                                        |    1 +
 plugins/plot_distrib/gog-probability-plot.c |    8 +++++-
 plugins/plot_xy/gog-xy.c                    |   30 +++++++++++++-------------
 4 files changed, 31 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index df88df2..24beae7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-11-26  Jean Brefort  <jean brefort normalesup org>
+
+	* plugins/plot_distrib/gog-probability-plot.c
+	(gog_probability_plot_populate_editor) don't unref the new widget [#603015],
+	(gog_probability_plot_update): check if there is a series before using it.
+	[#603016]
+	* plugins/plot_xy/gog-xy.c (gog_2d_plot_update): do not check error bars
+	for a NULL series.
+
 2009-11-22  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/graph/gog-view.c (gog_view_get_view_at_point): allow obj to
diff --git a/NEWS b/NEWS
index 0e7d611..6512ce3 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Jean:
 	* Add an option for negative values display in pies and rings. [#152614]
 	* Add trend lines to legend. [#383518]
 	* Build color from color names usung gdk_parse_color. [#601114]
+	* Fix crashes in probablility plots [#603015, #603016] and scatter plots.
 
 --------------------------------------------------------------------------
 goffice 0.7.15:
diff --git a/plugins/plot_distrib/gog-probability-plot.c b/plugins/plot_distrib/gog-probability-plot.c
index 82ba74c..fea56a9 100644
--- a/plugins/plot_distrib/gog-probability-plot.c
+++ b/plugins/plot_distrib/gog-probability-plot.c
@@ -61,7 +61,6 @@ gog_probability_plot_populate_editor (GogObject *item,
 {
 	GtkWidget *w = go_distribution_pref_new (G_OBJECT (item), dalloc, cc);
 	go_editor_add_page (editor, w, _("Distribution"));
-	g_object_unref (w);
 
 	(GOG_OBJECT_CLASS(probability_plot_parent_klass)->populate_editor) (item, editor, dalloc, cc);
 }
@@ -71,7 +70,12 @@ static void
 gog_probability_plot_update (GogObject *obj)
 {
 	GogProbabilityPlot *plot = GOG_PROBABILITY_PLOT (obj);
-	GogProbabilityPlotSeries *series = GOG_PROBABILITY_PLOT_SERIES (
+	GogProbabilityPlotSeries *series;
+
+	if (plot->base.series == NULL)
+		return;
+
+	series = GOG_PROBABILITY_PLOT_SERIES (
 		plot->base.series->data);
 
 
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index 66ed780..6c2da8b 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -125,25 +125,25 @@ gog_2d_plot_update (GogObject *obj)
 
 		if (x_min > tmp_min) x_min = tmp_min;
 		if (x_max < tmp_max) x_max = tmp_max;
+		/* add room for error bars */
+		if (gog_error_bar_is_visible (series->x_errors)) {
+			gog_error_bar_get_minmax (series->x_errors, &tmp_min, &tmp_max);
+			if (x_min > tmp_min)
+				x_min = tmp_min;
+			if (x_max < tmp_max)
+				x_max = tmp_max;
+		}
+		if (gog_error_bar_is_visible (series->y_errors)) {
+			gog_error_bar_get_minmax (series->y_errors, &tmp_min, &tmp_max);
+			if (y_min > tmp_min)
+				y_min = tmp_min;
+			if (y_max < tmp_max)
+				y_max = tmp_max;
+		}
 	}
 
 	/*adjust bounds to allow large markers or bubbles*/
 	gog_2d_plot_adjust_bounds (model, &x_min, &x_max, &y_min, &y_max);
-	/* add room for error bars */
-	if (gog_error_bar_is_visible (series->x_errors)) {
-		gog_error_bar_get_minmax (series->x_errors, &tmp_min, &tmp_max);
-		if (x_min > tmp_min)
-			x_min = tmp_min;
-		if (x_max < tmp_max)
-			x_max = tmp_max;
-	}
-	if (gog_error_bar_is_visible (series->y_errors)) {
-		gog_error_bar_get_minmax (series->y_errors, &tmp_min, &tmp_max);
-		if (y_min > tmp_min)
-			y_min = tmp_min;
-		if (y_max < tmp_max)
-			y_max = tmp_max;
-	}
 
 	if (model->x.minima != x_min || model->x.maxima != x_max) {
 		model->x.minima = x_min;



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