goffice r2037 - in trunk: . plugins/plot_barcol
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: goffice r2037 - in trunk: . plugins/plot_barcol
- Date: Sun, 24 Feb 2008 03:12:53 +0000 (GMT)
Author: mortenw
Date: Sun Feb 24 03:12:53 2008
New Revision: 2037
URL: http://svn.gnome.org/viewvc/goffice?rev=2037&view=rev
Log:
* Fix memory handling for 1.5d plots. Fixes #517995.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/plugins/plot_barcol/gog-1.5d.c
trunk/plugins/plot_barcol/gog-line.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sun Feb 24 03:12:53 2008
@@ -1,7 +1,10 @@
goffice 0.6.2:
Jean:
- * Set Lentgh to 0 for invalid series in 1.5d plots. Fixes #514642.
+ * Set Length to 0 for invalid series in 1.5d plots. Fixes #514642.
+
+Morten:
+ * Fix memory handling for 1.5d plots. Fixes #517995.
--------------------------------------------------------------------------
goffice 0.6.1:
Modified: trunk/plugins/plot_barcol/gog-1.5d.c
==============================================================================
--- trunk/plugins/plot_barcol/gog-1.5d.c (original)
+++ trunk/plugins/plot_barcol/gog-1.5d.c Sun Feb 24 03:12:53 2008
@@ -156,14 +156,12 @@
GogPlot1_5dClass *klass = GOG_PLOT1_5D_GET_CLASS (obj);
GogSeries1_5d const *series;
unsigned i, num_elements, num_series;
- double **vals, minima, maxima;
+ double minima, maxima;
double old_minima, old_maxima;
- unsigned *lengths;
GSList *ptr;
GOData *index_dim = NULL;
GogPlot *plot_that_labeled_axis;
GogAxis *axis;
- GogErrorBar **errors;
gboolean index_changed = FALSE;
old_minima = model->minima;
@@ -228,11 +226,12 @@
if (num_elements <= 0 || num_series <= 0)
model->minima = model->maxima = 0.;
else if (model->type != GOG_1_5D_NORMAL) {
- vals = g_alloca (num_series * sizeof (double *));
- errors = g_alloca (num_series * sizeof (GogErrorBar *));
- lengths = g_alloca (num_series * sizeof (unsigned));
+ double **vals = g_new0 (double *, num_series);
+ GogErrorBar **errors = g_new0 (GogErrorBar *, num_series);
+ unsigned *lengths = g_new0 (unsigned, num_series);
+
i = 0;
- for (ptr = model->base.series ; ptr != NULL ; ptr = ptr->next, i++) {
+ for (ptr = model->base.series ; ptr != NULL ; ptr = ptr->next) {
series = ptr->data;
/* we are guaranteed that at least 1 series is valid above */
if (!gog_series_is_valid (GOG_SERIES (series))) {
@@ -246,10 +245,16 @@
g_object_unref (errors[i]);
lengths[i] = go_data_vector_get_len (
GO_DATA_VECTOR (series->base.values[1].data));
+
+ i++;
}
if (klass->update_stacked_and_percentage)
klass->update_stacked_and_percentage (model, vals, errors, lengths);
+
+ g_free (vals);
+ g_free (errors);
+ g_free (lengths);
}
if (old_minima != model->minima || old_maxima != model->maxima)
Modified: trunk/plugins/plot_barcol/gog-line.c
==============================================================================
--- trunk/plugins/plot_barcol/gog-line.c (original)
+++ trunk/plugins/plot_barcol/gog-line.c Sun Feb 24 03:12:53 2008
@@ -219,7 +219,7 @@
tmp = vals[j][i];
if (!go_finite (tmp))
continue;
- if (gog_error_bar_is_visible (errors[j])) {
+ if (gog_error_bar_is_visible (errors[j])) {
gog_error_bar_get_bounds (errors[j], i, &errminus, &errplus);
errminus = errminus > 0. ? errminus: 0.;
errplus = errplus > 0. ? errplus : 0.;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]