GnuCash
Contact   Instructions
Bug 798098 - Crash popup show when have 3 Windows in OSX
Summary: Crash popup show when have 3 Windows in OSX
Status: RESOLVED FIXED
Alias: None
Product: Bugzilla
Classification: Unclassified
Component: All (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: general
QA Contact: general
URL:
Whiteboard:
Keywords:
: 798137 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-01-24 04:07 EST by chaintng
Modified: 2021-02-26 04:33 EST (History)
5 users (show)

See Also:


Attachments
crash dialog (804.25 KB, image/png)
2021-01-24 04:07 EST, chaintng
no flags Details

Description chaintng 2021-01-24 04:07:23 EST
Created attachment 373983 [details]
crash dialog

Step to reproduce
- Fresh install
- Add 2 new windows to make it become 3 windows
- Quit the application

The crash popup will show, as in screenshot

It start to happen on GnuCash 4.3
At least on Apple Macbook Air M1 chipset.

Please help check.

thank you.
Comment 1 Bob 2021-01-24 09:37:06 EST
As a first step, please upgrade to version 4.4 and see if that fixes your issue.
Comment 2 chaintng 2021-01-24 10:12:05 EST
Yes, the issue happen both 4.3 and 4.4
Comment 3 chaintng 2021-01-24 10:12:28 EST
Yes, the issue happen both 4.3 and 4.4
Comment 4 Bob 2021-01-24 10:40:24 EST
What do the three windows contain, are they all registers or do some have reports open in them.

Does the number of windows matter, does just two windows behave ?

Can you add the full crash report, I do not have a mac but may help identify problem.
Comment 5 chaintng 2021-01-24 12:19:44 EST
Hi, 
I tested with empty windows
It also crashed.
(New file, add new 2 empty windows and quit, crashed)

I tested on older Mac (Intel chipset)
It also reproducible

Here is full log

https://gist.github.com/chaintng/d491645b70a9ebbf6564280cd7176dae
Comment 6 John Ralls 2021-01-25 15:26:27 EST
Here's the top of the stack with debugging symbols:
  * frame #0: 0x0000000101eba995 libgobject-2.0.0.dylib`g_type_check_instance_cast(type_instance=0x000000010c842310, iface_type=4486990448) at gtype.c:4060:55 [opt]
    frame #1: 0x0000000100f92611 libgnc-gnome-utils.dylib`gnc_main_window_close_page(page=0x000000010b9d3130) at gnc-main-window.c:3330:33
    frame #2: 0x0000000100c82a72 libgnc-gnome.dylib`gnc_plugin_page_account_tree_close_cb(user_data=0x000000010b9d3130) at gnc-plugin-page-account-tree.c:703:5
    frame #3: 0x0000000100f6ee35 libgnc-gnome-utils.dylib`gnc_close_gui_component(component_id=1) at gnc-component-manager.c:781:9
    frame #4: 0x0000000100f6efb0 libgnc-gnome-utils.dylib`gnc_close_gui_component_by_session(session=0x0000000153b0d7c0) at gnc-component-manager.c:837:9
    frame #5: 0x0000000100f83ba6 libgnc-gnome-utils.dylib`gnc_file_quit at gnc-file.c:1726:5

And the reason for the crash:
(lldb) p *window
(GncMainWindow) $2 = {
  gtk_window = {
    bin = {
      container = {
        widget = {
          parent_instance = {
            g_type_instance = {
              g_class = 0xaaaaaaaaaaaaaaaa
            }
            ref_count = 2863311530
            qdata = 0xaaaaaaaaaaaaaaaa
          }
          priv = 0xaaaaaaaaaaaaaaaa
        }
        priv = 0xaaaaaaaaaaaaaaaa
      }
      priv = 0xaaaaaaaaaaaaaaaa
    }
    priv = 0xaaaaaaaaaaaaaaaa
  }
  ui_merge = 0xaaaaaaaaaaaaaaaa
  window_quitting = -1431655766
  just_plugin_prefs = -1431655766
}

So the window has already been freed, the trick is to figure out where. Note that this doesn't happen on Linux or Windows because distros build GLib with debugging disabled and I build it with minimal debugging.

@Bob, he's creating truly empty windows with Windows>New Window.
Comment 7 John Ralls 2021-01-25 16:03:18 EST
Well, that was easy. The first free was exactly 2 lines above.

Fixed for 4.5, thanks for the report.
Comment 8 John Ralls 2021-01-25 16:13:17 EST
@Bob, it appears that in this case we still leak any empty windows. That's probably not a big deal given that we're shutting down but it's still not ideal. If you have some free cycles you might look into checking that all windows on the active window list are freed at shutdown.
Comment 9 Bob 2021-01-26 08:03:56 EST
I am looking at this with my Linux VM. What I have found with the code as was, all seems to work OK with two windows of any sort. If I do as the reporter, one with the account tree and two or more other windows empty or not I get a failure on the second gtk_widget_destroy.

I am also seeing that one window is not calling gnc_window_destroy.

Will investigate...
Comment 10 John Ralls 2021-01-26 11:41:59 EST
Does the window that doesn't have gtk_window_destroy called on it have a page?
Comment 11 Bob 2021-02-26 04:33:56 EST
*** Bug 798137 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.