gnucash maint: Bug 796981 - Gnucash crashes with critical error when selecting another file
John Ralls
jralls at code.gnucash.org
Sat Dec 22 15:06:18 EST 2018
Updated via https://github.com/Gnucash/gnucash/commit/4585f60d (commit)
from https://github.com/Gnucash/gnucash/commit/294c932e (commit)
commit 4585f60dd94593c76fde7769d54efddaddf3197d
Author: John Ralls <jralls at ceridwen.us>
Date: Sat Dec 22 11:36:58 2018 -0800
Bug 796981 - Gnucash crashes with critical error when selecting another file
The problem is that if the currently open file has a report tab with
another tab to its right and selected then when the selected tab is
closed by the shutdown code Gtk sends a "realize" signal to the report
page. That sets an idle event to gnc_plugin_page_report_load_uri, but the
shutdown code proceeds to destroy the page and GnuCash has loaded the new
session before the idle event fires. By that time there's no page so
GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE naturally returns NULL and the first
dereference crashes.
I couldn't find an easy way to avoid queuing the idle so I opted to protect
the function from the NULL priv.
diff --git a/gnucash/report/report-gnome/gnc-plugin-page-report.c b/gnucash/report/report-gnome/gnc-plugin-page-report.c
index 792792c..40cbc58 100644
--- a/gnucash/report/report-gnome/gnc-plugin-page-report.c
+++ b/gnucash/report/report-gnome/gnc-plugin-page-report.c
@@ -393,8 +393,9 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
report = GNC_PLUGIN_PAGE_REPORT(page);
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+ if (!priv)
+ return FALSE; // No priv means the page doesn't exist anymore.
- // FIXME. This is f^-1(f(x)), isn't it?
DEBUG( "Load uri id=%d", priv->reportId );
id_name = g_strdup_printf("id=%d", priv->reportId );
child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL );
Summary of changes:
gnucash/report/report-gnome/gnc-plugin-page-report.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list