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.
This commit is contained in:
John Ralls 2018-12-22 11:36:58 -08:00
parent 294c932e3b
commit 4585f60dd9

View File

@ -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 );