Fix Critical errors when SX editor loaded

When the SX editor is loaded, an embedded register plug-in page is
created and as part of this the business menus and actions are updated.
As this is an GncEmbeddedWindow they fail so test for a normal main
window before proceeding.
This commit is contained in:
Robert Fewell 2017-12-30 17:14:17 +00:00
parent b8a85ab80a
commit 19e0f58763

View File

@ -910,6 +910,10 @@ gnc_plugin_business_update_menus (GncPluginPage *plugin_page)
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
return;
// Check that this is a main window and not embedded sx
if (!GNC_IS_MAIN_WINDOW(plugin_page->window))
return;
is_txn_register = GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page);
window = GNC_MAIN_WINDOW(plugin_page->window);
g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
@ -1055,6 +1059,10 @@ static void update_inactive_actions(GncPluginPage *plugin_page)
if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
return;
// Check that this is a main window and not embedded sx
if (!GNC_IS_MAIN_WINDOW(plugin_page->window))
return;
window = GNC_MAIN_WINDOW(plugin_page->window);
g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
action_group = gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME);