[Gnucash-changes] r12988 - gnucash/trunk/src/report/report-gnome -
Avoid showing any invalid reports.
Chris Shoemaker
chris at cvs.gnucash.org
Fri Jan 27 00:27:11 EST 2006
Author: chris
Date: 2006-01-27 00:27:08 -0500 (Fri, 27 Jan 2006)
New Revision: 12988
Trac: http://svn.gnucash.org/trac/changeset/12988
Modified:
gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
gnucash/trunk/src/report/report-gnome/window-report.c
Log:
Avoid showing any invalid reports.
Modified: gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c 2006-01-27 05:13:46 UTC (rev 12987)
+++ gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c 2006-01-27 05:27:08 UTC (rev 12988)
@@ -667,6 +667,11 @@
report = GNC_PLUGIN_PAGE_REPORT(plugin_page);
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+ if (!priv || !priv->cur_report || SCM_NULLP(priv->cur_report) ||
+ SCM_UNBNDP(priv->cur_report) || SCM_BOOL_F == priv->cur_report) {
+ LEAVE("not saving invalid report");
+ return;
+ }
gen_save_text = scm_c_eval_string("gnc:report-generate-restore-forms");
scm_text = scm_call_1(gen_save_text, priv->cur_report);
@@ -864,13 +869,14 @@
GncPluginPageReportClass *our_class;
GObjectClass *parent_class;
gint reportId = -42;
- int i = 0;
+ int i;
- our_class = GNC_PLUGIN_PAGE_REPORT_CLASS (g_type_class_peek (GNC_TYPE_PLUGIN_PAGE_REPORT));
+ our_class = GNC_PLUGIN_PAGE_REPORT_CLASS (
+ g_type_class_peek (GNC_TYPE_PLUGIN_PAGE_REPORT));
parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (our_class));
obj = parent_class->constructor(this_type, n_properties, properties);
- for (; i < n_properties; i++)
+ for (i = 0; i < n_properties; i++)
{
GObjectConstructParam prop = properties[i];
if (strcmp(prop.pspec->name,"report-id") == 0)
Modified: gnucash/trunk/src/report/report-gnome/window-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/window-report.c 2006-01-27 05:13:46 UTC (rev 12987)
+++ gnucash/trunk/src/report/report-gnome/window-report.c 2006-01-27 05:27:08 UTC (rev 12988)
@@ -318,10 +318,18 @@
gnc_html_register_url_handler (URL_TYPE_HELP, gnc_html_help_url_cb);
}
+
+static gboolean
+remove_invalid_report(gpointer key, gpointer val, gpointer data)
+{
+ SCM report = val;
+ return (NULL == gnc_report_name(report));
+}
+
static void
show_report(gpointer key, gpointer val, gpointer data)
{
- gnc_main_window_open_report(GPOINTER_TO_INT(key), NULL);
+ gnc_main_window_open_report(*(gint *)key, NULL);
}
void
@@ -329,6 +337,8 @@
{
GHashTable *reports = gnc_reports_get_global();
- if (reports)
+ if (reports) {
+ g_hash_table_foreach_remove(reports, remove_invalid_report, NULL);
g_hash_table_foreach(reports, show_report, NULL);
+ }
}
More information about the gnucash-changes
mailing list