gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Fri May 21 07:23:07 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/e0c260fe (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3bb6801e (commit)
	from  https://github.com/Gnucash/gnucash/commit/4ab9bd4d (commit)



commit e0c260fe0bc0ae5deef240432968c6ef2b812662
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu May 20 08:12:54 2021 +0800

    Bug 798188 - The Invoice Editor -> Printable Invoice toolbar button crashes on Windows
    
    search the list of active report pages.

diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
index ceb9bb2d1..b05760ea3 100644
--- a/gnucash/gnome/dialog-invoice.c
+++ b/gnucash/gnome/dialog-invoice.c
@@ -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
diff --git a/gnucash/gnome/gnc-plugin-page-budget.c b/gnucash/gnome/gnc-plugin-page-budget.c
index 4db252454..8a968bdf0 100644
--- a/gnucash/gnome/gnc-plugin-page-budget.c
+++ b/gnucash/gnome/gnc-plugin-page-budget.c
@@ -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
     {

commit 3bb6801e940bb94f754db8bd9c43e4b39b56e08b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri May 21 19:00:30 2021 +0800

    move WINDOW_REPORT_CM_CLASS definition to gnc-plugin-page-report.h
    
    and remove unused definition in window-report.h

diff --git a/gnucash/gnome/gnc-plugin-page-report.c b/gnucash/gnome/gnc-plugin-page-report.c
index fce3a8a47..3445b6ce7 100644
--- a/gnucash/gnome/gnc-plugin-page-report.c
+++ b/gnucash/gnome/gnc-plugin-page-report.c
@@ -76,8 +76,6 @@
 #include "gnc-icons.h"
 #include "print-session.h"
 
-#define WINDOW_REPORT_CM_CLASS "window-report"
-
 /* NW: you can add GNC_MOD_REPORT to gnc-engine.h
 or simply define it locally. Any unique string with
 a gnucash- prefix will do. Then just set a log level
diff --git a/gnucash/gnome/gnc-plugin-page-report.h b/gnucash/gnome/gnc-plugin-page-report.h
index 87dcc468f..55da7a652 100644
--- a/gnucash/gnome/gnc-plugin-page-report.h
+++ b/gnucash/gnome/gnc-plugin-page-report.h
@@ -49,6 +49,8 @@ G_BEGIN_DECLS
 
 #define GNC_PLUGIN_PAGE_REPORT_NAME "GncPluginPageReport"
 
+#define WINDOW_REPORT_CM_CLASS "window-report"
+
 /* typedefs & structures */
 typedef struct
 {
diff --git a/gnucash/gnome/window-report.c b/gnucash/gnome/window-report.c
index 28240d082..31df07d5b 100644
--- a/gnucash/gnome/window-report.c
+++ b/gnucash/gnome/window-report.c
@@ -44,9 +44,6 @@
 
 #include "gnc-plugin-page-report.h"
 
-#define WINDOW_REPORT_CM_CLASS "window-report"
-#define MDI_CHILD_CONFIG "mdi_child_config"
-
 /********************************************************************
  *
  ********************************************************************/



Summary of changes:
 gnucash/gnome/dialog-invoice.c         | 9 ++++++++-
 gnucash/gnome/gnc-plugin-page-budget.c | 9 ++++++++-
 gnucash/gnome/gnc-plugin-page-report.c | 2 --
 gnucash/gnome/gnc-plugin-page-report.h | 2 ++
 gnucash/gnome/window-report.c          | 3 ---
 5 files changed, 18 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list