gnucash stable: Bug 799060 - Consistent Crash in Invoices

John Ralls jralls at code.gnucash.org
Fri Aug 18 18:53:28 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/38435a75 (commit)
	from  https://github.com/Gnucash/gnucash/commit/6c99523a (commit)



commit 38435a75dec8f15e3f3f28464c0e48a2a3b30864
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Aug 18 15:41:11 2023 -0700

    Bug 799060 - Consistent Crash in Invoices
    
    {macOS] NSApp remembers the last menu set and if the window that owns
    it is deleted then trying to reference that will crash. Avoid that
    by reseting the menu to the next or previous window on the active
    windows list when destroying a window.

diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp
index 99900ade4d..6412668279 100644
--- a/gnucash/gnome-utils/gnc-main-window.cpp
+++ b/gnucash/gnome-utils/gnc-main-window.cpp
@@ -2869,7 +2869,11 @@ gnc_main_window_destroy (GtkWidget *widget)
     g_return_if_fail (GNC_IS_MAIN_WINDOW (widget));
 
     window = GNC_MAIN_WINDOW (widget);
-
+#ifdef MAC_INTEGRATION
+    auto entry = g_list_find (active_windows, window);
+    if (entry && (entry->next || entry->prev))
+        gnc_quartz_set_menu (GNC_MAIN_WINDOW (entry->next ? entry->next->data : entry->prev->data));
+#endif
     active_windows = g_list_remove (active_windows, window);
 
     /* Do these things once */



Summary of changes:
 gnucash/gnome-utils/gnc-main-window.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list