Bug 798188 - The Invoice Editor -> Printable Invoice toolbar button crashes on Windows

search the list of active report pages.
This commit is contained in:
Christopher Lam 2021-05-20 08:12:54 +08:00
parent 3bb6801e94
commit e0c260fe0b
2 changed files with 16 additions and 2 deletions

View File

@ -823,6 +823,12 @@ gnc_invoice_window_print_invoice(GtkWindow *parent, GncInvoice *invoice)
return reportPage;
}
static gboolean
equal_fn (gpointer find_data, gpointer elt_data)
{
return (find_data && (find_data == elt_data));
}
/* From the invoice editor, open the invoice report. This will reuse the
invoice report if generated from the current invoice editor. Note the
link is lost when GnuCash is restarted. This link may be restored
@ -834,7 +840,8 @@ gnc_invoice_window_printCB (GtkWindow* parent, gpointer data)
{
InvoiceWindow *iw = data;
if (iw->reportPage && GNC_IS_PLUGIN_PAGE (iw->reportPage))
if (gnc_find_first_gui_component (WINDOW_REPORT_CM_CLASS, equal_fn,
iw->reportPage))
gnc_plugin_page_report_reload (GNC_PLUGIN_PAGE_REPORT (iw->reportPage));
else
iw->reportPage = gnc_invoice_window_print_invoice

View File

@ -1286,6 +1286,12 @@ gnc_plugin_page_budget_cmd_budget_note(GtkAction *action,
g_object_unref(G_OBJECT(builder));
}
static gboolean
equal_fn (gpointer find_data, gpointer elt_data)
{
return (find_data && (find_data == elt_data));
}
/* From the budget editor, open the budget report. This will reuse the
budget report if generated from the current budget editor. Note the
reuse is lost when GnuCash is restarted. This link may be restored
@ -1302,7 +1308,8 @@ gnc_plugin_page_budget_cmd_budget_report (GtkAction *action,
priv = GNC_PLUGIN_PAGE_BUDGET_GET_PRIVATE (page);
if (priv->reportPage && GNC_IS_PLUGIN_PAGE (priv->reportPage))
if (gnc_find_first_gui_component (WINDOW_REPORT_CM_CLASS, equal_fn,
priv->reportPage))
gnc_plugin_page_report_reload (GNC_PLUGIN_PAGE_REPORT (priv->reportPage));
else
{