r15420 - gnucash/trunk/src/gnome-utils - Do not %s-printf NULL-title of average balance plot. Fix #397935.
Andreas Köhler
andi5 at cvs.gnucash.org
Mon Jan 22 21:50:43 EST 2007
Author: andi5
Date: 2007-01-22 21:50:40 -0500 (Mon, 22 Jan 2007)
New Revision: 15420
Trac: http://svn.gnucash.org/trac/changeset/15420
Modified:
gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c
Log:
Do not %s-printf NULL-title of average balance plot. Fix #397935.
The average balance report does not specify a title for the plot, so we
must not printf it or GnuCash will crash on Windows.
Modified: gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c 2007-01-22 16:35:11 UTC (rev 15419)
+++ gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c 2007-01-23 02:50:40 UTC (rev 15420)
@@ -231,23 +231,22 @@
static void
set_chart_titles(GogObject *chart, const char *title, const char* sub_title)
{
- GString *totalTitle;
- GOData *titleScalar;
+ gchar *my_sub_title, *total_title;
+ GOData *title_scalar;
GogObject *tmp;
- totalTitle = g_string_sized_new(32);
- g_string_printf(totalTitle, "%s", title);
- if (sub_title != NULL)
- {
- g_string_append_printf(totalTitle, " (%s)", sub_title);
- }
+ if (sub_title)
+ my_sub_title = g_strdup_printf("%s(%s)", title ? " " : "", sub_title);
+ else
+ my_sub_title = g_strdup("");
+ total_title = g_strdup_printf("%s%s", title ? title : "", my_sub_title);
+
tmp = gog_object_add_by_name(chart, "Title", NULL);
- titleScalar = go_data_scalar_str_new(totalTitle->str, FALSE);
- gog_dataset_set_dim(GOG_DATASET(tmp), 0, titleScalar, NULL);
+ title_scalar = go_data_scalar_str_new(total_title, TRUE);
+ gog_dataset_set_dim(GOG_DATASET(tmp), 0, title_scalar, NULL);
- // @@fixme -- record or ref the string for freeing...
- g_string_free(totalTitle, FALSE);
+ g_free(my_sub_title);
}
static void
More information about the gnucash-changes
mailing list