After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 366468 - Crash when creating a new stock account
Crash when creating a new stock account
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: User Interface General
git-master
Other Linux
: High critical
: ---
Assigned To: David Hampton
Chris Shoemaker
: 400459 406870 411203 426414 431204 431453 435477 436916 441411 441515 441709 442008 442385 442903 446376 448024 449593 449889 450640 451115 451343 452563 453262 465312 470257 470568 472598 480709 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-10-28 20:04 UTC by Chris Shoemaker
Modified: 2018-06-29 21:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Chris Shoemaker 2006-10-28 20:04:27 UTC
In the Create New Account Dialog, I had selected 'Stock' type and created a new commodity for the commodity field.  Then, I clicked 'ok', and got the following.  This is r14992 on trunk.

I had just clicked 'ok' in the Create New Account dialog.

  • #0 ??
  • #1 __waitpid_nocancel
    from /lib/libpthread.so.0
  • #2 gnome_gtk_module_info_get
    from /usr/lib/libgnomeui-2.so.0
  • #3 <signal handler called>
  • #4 gnc_main_window_disconnect
    at gnc-main-window.c line 1924
  • #5 gnc_main_window_close_page
    at gnc-main-window.c line 2129
  • #6 gppr_account_destroy_cb
    at gnc-plugin-page-register.c line 2836
  • #7 aw_call_destroy_callbacks
    at dialog-account.c line 154
  • #8 gnc_ui_to_account
    at dialog-account.c line 323
  • #9 gnc_finish_ok
    at dialog-account.c line 494
  • #10 gnc_new_account_ok
    at dialog-account.c line 860
  • #11 gnc_account_window_response_cb
    at dialog-account.c line 877
  • #12 g_cclosure_marshal_VOID
    from /usr/lib/libgobject-2.0.so.0
  • #13 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #14 g_signal_override_class_closure
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #16 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #17 gtk_dialog_response
    from /usr/lib/libgtk-x11-2.0.so.0
  • #18 gtk_dialog_response
    from /usr/lib/libgtk-x11-2.0.so.0
  • #19 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #20 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #21 g_signal_override_class_closure
    from /usr/lib/libgobject-2.0.so.0
  • #22 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #23 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #24 gtk_button_clicked
    from /usr/lib/libgtk-x11-2.0.so.0
  • #25 gtk_button_set_alignment
    from /usr/lib/libgtk-x11-2.0.so.0
  • #26 g_cclosure_marshal_VOID__VOID
    from /usr/lib/libgobject-2.0.so.0
  • #27 g_value_set_static_boxed
    from /usr/lib/libgobject-2.0.so.0
  • #28 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #29 g_signal_override_class_closure
    from /usr/lib/libgobject-2.0.so.0
  • #30 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #31 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #32 gtk_button_released
    from /usr/lib/libgtk-x11-2.0.so.0
  • #33 gtk_button_released
    from /usr/lib/libgtk-x11-2.0.so.0
  • #34 gtk_marshal_BOOLEAN__VOID

Comment 1 Chris Shoemaker 2006-10-29 00:20:55 UTC
Notes:
  This was in the log:
Error: xaccAccountTypesCompatibleWith(): bad account type: -1

I think that means that gnc_account_parent_changed_cb() must have set the aw->type to ACCT_TYPE_INVALID at some time, but aw->type seems to correctly be ACCT_TYPE_STOCK at the point of the crash.


And this was in the console:
(gnucash:13831): GLib-GObject-WARNING **: invalid cast from `GncEmbeddedWindow' to `GncMainWindow'
(gnucash:13831): GLib-GObject-WARNING **: attempt to retrieve private data for invalid type 'GncMainWindow'


I had the Checking Account open in a register, and I had two instances of GnuCash running at the time.

I couldn't reproduce this when I tried again.

I attached gdb to this instance and noticed something strange.  In the gppr_account_destroy_cb() frame 

 citem = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER_NAME);

had returned a list of 4 pages, even though I had only one register open.

3 of them were added to the kill list, and the first item was the one that was crashing upon _close_page().  

'account' is an empty, bare, account.  It has a valid QofType of "Account" but it has no children or parent Groups, and its type is ACCT_TYPE_INVALID.  This account's guid _does_ match the AccountWindow.account guid.

Ok, I think I understand now. New comment...
Comment 2 Chris Shoemaker 2006-10-29 01:10:57 UTC
Here's what's happening.  Key info: I had the SLR dialog still open from it opening automatically at startup.

When creating a new account, gppr_account_destroy_cb() gets called.  Its function is to close all registers that are either for the given account and General Ledgers.  This search finds the register(s?) in the GncEmbeddedWindow belonging to the SLR dialog.  But, it assumes that the pages belong to the GncMainWindow so it calls gnc_main_window_close_page().  This is wrong, and it's not handled gracefully, so it crashes.

I think there are two ways to fix it.

Quick way) Teach gnc_main_window_close_page() or gppr_account_destroy_cb() to be more restrictive.

Right way) IMO, the gppr_account_destroy_cb() isn't the right mechanism for closing registers whose account type has changed.  Instead, the component manager offers this functionality, and it should be used.  That way, the logic for when to delete the object resides in the component that would be closed.  That would prevent problems like this - making incorrect assumptions about what types of objects exist.
Comment 3 Andreas Köhler 2007-02-11 02:14:19 UTC
*** Bug 400459 has been marked as a duplicate of this bug. ***
Comment 4 Andreas Köhler 2007-02-12 00:25:18 UTC
*** Bug 406870 has been marked as a duplicate of this bug. ***
Comment 5 Andreas Köhler 2007-02-23 21:36:12 UTC
*** Bug 411203 has been marked as a duplicate of this bug. ***
Comment 6 Christian Stimming 2007-04-05 08:19:22 UTC
*** Bug 426414 has been marked as a duplicate of this bug. ***
Comment 7 Christian Stimming 2007-04-19 08:05:54 UTC
*** Bug 431204 has been marked as a duplicate of this bug. ***
Comment 8 Andreas Köhler 2007-04-20 05:55:07 UTC
*** Bug 431453 has been marked as a duplicate of this bug. ***
Comment 9 Christian Stimming 2007-05-05 12:16:14 UTC
*** Bug 435477 has been marked as a duplicate of this bug. ***
Comment 10 Christian Stimming 2007-06-04 13:45:29 UTC
*** Bug 442903 has been marked as a duplicate of this bug. ***
Comment 11 Christian Stimming 2007-06-04 13:56:10 UTC
*** Bug 436916 has been marked as a duplicate of this bug. ***
Comment 12 Christian Stimming 2007-06-04 13:56:19 UTC
*** Bug 441411 has been marked as a duplicate of this bug. ***
Comment 13 Christian Stimming 2007-06-04 13:56:24 UTC
*** Bug 441515 has been marked as a duplicate of this bug. ***
Comment 14 Christian Stimming 2007-06-04 13:56:29 UTC
*** Bug 441709 has been marked as a duplicate of this bug. ***
Comment 15 Christian Stimming 2007-06-04 13:56:38 UTC
*** Bug 442385 has been marked as a duplicate of this bug. ***
Comment 16 Christian Stimming 2007-06-04 14:00:57 UTC
*** Bug 442008 has been marked as a duplicate of this bug. ***
Comment 17 Andreas Köhler 2007-06-12 05:42:34 UTC
*** Bug 446376 has been marked as a duplicate of this bug. ***
Comment 18 peterlaz 2007-06-17 11:01:39 UTC
Workaround.
Based on the comments about closing accounts etc. I found that if the only gnucash window open is the main window listing accounts, there's no crash in adding a new account. When another window was open e.g. confirmation of scheduled transactions, adding another account crashed gnucash.

At least I can now continue using this package. 
Comment 19 Christian Stimming 2007-06-21 08:45:36 UTC
*** Bug 449593 has been marked as a duplicate of this bug. ***
Comment 20 Christian Stimming 2007-06-21 08:55:12 UTC
Could we just fix this "the quick way" by adding in gnc_main_window_close_page an additional check 

if (!GNC_IS_MAIN_WINDOW(page->window))
  return;

right before the GNC_MAIN_WINDOW(...) case? Sounds to me this should at least fix the crashes.
Comment 21 Christian Stimming 2007-06-22 07:54:01 UTC
*** Bug 449889 has been marked as a duplicate of this bug. ***
Comment 22 Christian Stimming 2007-06-22 20:38:24 UTC
The crash can be reproduced with SVN-trunk as of today if the Scheduled Transaction Editor is open, and a new account is being created. Crash on Ok.

Once I add the lines from comment#20, it does no longer crash. I now get this warning:

* 22:33:18  CRIT <Gtk> gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

but apart from that at least we don't have a crash. I committed this workaround as 
r16207 which will be in 2.1.5 or 2.2.0 any later version.
Comment 23 Andreas Köhler 2007-06-24 16:17:21 UTC
*** Bug 450640 has been marked as a duplicate of this bug. ***
Comment 24 Christian Stimming 2007-06-26 08:01:34 UTC
*** Bug 451115 has been marked as a duplicate of this bug. ***
Comment 25 Andreas Köhler 2007-06-26 21:33:22 UTC
*** Bug 451343 has been marked as a duplicate of this bug. ***
Comment 26 Christian Stimming 2007-06-27 14:49:53 UTC
*** Bug 448024 has been marked as a duplicate of this bug. ***
Comment 27 Christian Stimming 2007-07-02 09:56:08 UTC
*** Bug 452563 has been marked as a duplicate of this bug. ***
Comment 28 Christian Stimming 2007-07-03 10:27:25 UTC
*** Bug 453262 has been marked as a duplicate of this bug. ***
Comment 29 Andreas Köhler 2007-08-10 12:04:11 UTC
*** Bug 465312 has been marked as a duplicate of this bug. ***
Comment 30 Chris Shoemaker 2007-08-25 18:14:48 UTC
*** Bug 470257 has been marked as a duplicate of this bug. ***
Comment 31 Andreas Köhler 2007-08-31 21:28:59 UTC
*** Bug 470568 has been marked as a duplicate of this bug. ***
Comment 32 Andreas Köhler 2007-09-03 23:10:30 UTC
*** Bug 472598 has been marked as a duplicate of this bug. ***
Comment 33 Andreas Köhler 2007-09-26 22:06:31 UTC
*** Bug 480709 has been marked as a duplicate of this bug. ***
Comment 34 John Ralls 2018-06-29 21:14:28 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=366468. Please update any external references or bookmarks.