Skip to content

Commit

Permalink
Bug 798188 - The Invoice Editor -> Printable Invoice toolbar button c…
Browse files Browse the repository at this point in the history
…rashes on Windows

search the list of active report pages.
  • Loading branch information
christopherlam committed May 21, 2021
1 parent 3bb6801 commit e0c260f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion gnucash/gnome/dialog-invoice.c
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion gnucash/gnome/gnc-plugin-page-budget.c
Expand Up @@ -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
Expand All @@ -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
{
Expand Down

0 comments on commit e0c260f

Please sign in to comment.