gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Thu Dec 12 17:23:17 EST 2024


Updated	 via  https://github.com/Gnucash/gnucash/commit/3fcb45eb (commit)
	 via  https://github.com/Gnucash/gnucash/commit/77a95b2d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8331f998 (commit)
	from  https://github.com/Gnucash/gnucash/commit/81e11f70 (commit)



commit 3fcb45eb355b96cbe2179182cc8ff7512d30eb30
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 12 14:22:02 2024 -0800

    Bug 799458 - Crash attempting to edit a scheduled transaction
    
    Caused by arbitrarily casting a random GtkBox to GncMainWindow. Get
    the GtkBox's parent main window instead.

diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
index bd02abe3d4..d7a2e25132 100644
--- a/gnucash/gnome-utils/gnc-plugin-page.c
+++ b/gnucash/gnome-utils/gnc-plugin-page.c
@@ -39,6 +39,7 @@
 #include "gnc-plugin.h"
 #include "gnc-plugin-page.h"
 #include "gnc-gobject-utils.h"
+#include "gnc-ui.h"
 
 /** The debugging module that this .o belongs to.  */
 static QofLogModule log_module = GNC_MOD_GUI;
@@ -891,7 +892,7 @@ gnc_plugin_page_inserted_cb (GncPluginPage *page, gpointer user_data)
                                               page);
 
     // on initial load try and set the page focus
-    if (!gnc_main_window_is_restoring_pages (GNC_MAIN_WINDOW(page->window)))
+    if (!gnc_main_window_is_restoring_pages (GNC_MAIN_WINDOW (gnc_ui_get_main_window (page->window))))
         (GNC_PLUGIN_PAGE_GET_CLASS(page)->focus_page)(page, TRUE);
 }
 

commit 77a95b2d498051086b8b77bb4b08395fc03df04f
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 12 14:21:29 2024 -0800

    Silence compile warning with a cast.

diff --git a/libgnucash/engine/qofquery.cpp b/libgnucash/engine/qofquery.cpp
index b36a0ba3b1..2a1be5e6c7 100644
--- a/libgnucash/engine/qofquery.cpp
+++ b/libgnucash/engine/qofquery.cpp
@@ -407,7 +407,7 @@ check_object (const QofQuery *q, gpointer object)
                     /* The last term is the actual parameter getter */
                     if (!node->next) break;
 
-                    conv_obj = param->param_getfcn (conv_obj, param);
+                    conv_obj = (void*)param->param_getfcn (conv_obj, param);
                 }
 
                 if (((qt->pred_fcn)(conv_obj, param, qt->pdata)) == qt->invert)

commit 8331f9988652582fc48e12cd4ad8dbd32c74d07e
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 12 14:20:25 2024 -0800

    Make struct GtkMainWindow private with accessor for just_plugin_prefs.

diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp
index 09e59c3a41..f55dace0f1 100644
--- a/gnucash/gnome-utils/gnc-main-window.cpp
+++ b/gnucash/gnome-utils/gnc-main-window.cpp
@@ -208,10 +208,16 @@ static void gnc_quartz_set_menu (GncMainWindow* window);
 #endif
 static void gnc_main_window_init_menu_updaters (GncMainWindow *window);
 
+struct _GncMainWindow
+{
+    GtkApplicationWindow gtk_application_window;  /**< The parent object for a main window. */
+    gboolean window_quitting;                     /**< Set to TRUE when quitting from this window. */
+    gboolean just_plugin_prefs;                   /**< Just remove preferences only from plugins */
+};
 
 /** The instance private data structure for an embedded window
  *  object. */
-typedef struct GncMainWindowPrivate
+typedef struct
 {
     /** The dock (vbox) at the top of the window containing the
      *  menubar and toolbar.  These items are generated by the UI
@@ -5666,5 +5672,11 @@ gnc_main_window_get_menu_model (GncMainWindow *window)
     return priv->menubar_model;
 }
 
+gboolean
+gnc_main_window_just_plugin_prefs (GncMainWindow* window)
+{
+    return window->just_plugin_prefs;
+}
+
 /** @} */
 /** @} */
diff --git a/gnucash/gnome-utils/gnc-main-window.h b/gnucash/gnome-utils/gnc-main-window.h
index 63bd933d6d..d5157a3074 100644
--- a/gnucash/gnome-utils/gnc-main-window.h
+++ b/gnucash/gnome-utils/gnc-main-window.h
@@ -63,12 +63,7 @@ typedef struct
 } GncMenuUpdate;
 
 /** The instance data structure for a main window object. */
-typedef struct GncMainWindow
-{
-    GtkApplicationWindow gtk_application_window;  /**< The parent object for a main window. */
-    gboolean window_quitting;                     /**< Set to TRUE when quitting from this window. */
-    gboolean just_plugin_prefs;                   /**< Just remove preferences only from plugins */
-} GncMainWindow;
+typedef struct _GncMainWindow GncMainWindow;
 
 /** The class data structure for a main window object. */
 typedef struct
@@ -545,6 +540,8 @@ void gnc_main_window_update_menu_and_toolbar (GncMainWindow *window,
  **/
 void gnc_main_window_show_all_windows(void);
 
+gboolean gnc_main_window_just_plugin_prefs (GncMainWindow* window);
+
 /**
  * Opens the Book Options dialog.
  *
diff --git a/gnucash/gnome-utils/gnc-plugin-menu-additions.c b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
index 69051b8630..483912b4b1 100644
--- a/gnucash/gnome-utils/gnc-plugin-menu-additions.c
+++ b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
@@ -543,7 +543,7 @@ gnc_plugin_menu_additions_remove_from_window (GncPlugin *plugin,
      * actions name is installed into the plugin class. */
     simple_action_group = gnc_main_window_get_action_group (window, PLUGIN_ACTIONS_NAME);
 
-    if (simple_action_group && !window->just_plugin_prefs)
+    if (simple_action_group && !gnc_main_window_just_plugin_prefs (window))
         gtk_widget_insert_action_group (GTK_WIDGET(window), PLUGIN_ACTIONS_NAME, NULL);
 
     LEAVE(" ");
diff --git a/gnucash/gnome-utils/gnc-plugin.c b/gnucash/gnome-utils/gnc-plugin.c
index 1dd26f1454..3cf42db4af 100644
--- a/gnucash/gnome-utils/gnc-plugin.c
+++ b/gnucash/gnome-utils/gnc-plugin.c
@@ -196,7 +196,7 @@ gnc_plugin_remove_from_window (GncPlugin *plugin,
     /*
      * Update window to remove UI items
      */
-    if (klass->actions_name && !window->just_plugin_prefs)
+    if (klass->actions_name && !gnc_main_window_just_plugin_prefs (window))
     {
         DEBUG ("%s: %d actions to unmerge",
                klass->actions_name, (klass->n_actions));



Summary of changes:
 gnucash/gnome-utils/gnc-main-window.cpp         | 14 +++++++++++++-
 gnucash/gnome-utils/gnc-main-window.h           |  9 +++------
 gnucash/gnome-utils/gnc-plugin-menu-additions.c |  2 +-
 gnucash/gnome-utils/gnc-plugin-page.c           |  3 ++-
 gnucash/gnome-utils/gnc-plugin.c                |  2 +-
 libgnucash/engine/qofquery.cpp                  |  2 +-
 6 files changed, 21 insertions(+), 11 deletions(-)



More information about the gnucash-changes mailing list