GNOME Bugzilla – Bug 340125
Crash when closing a book
Last modified: 2018-06-29 21:02:53 UTC
Backtrace was generated from '/home/bengt/unstable/gnucash/bin/gnucash' I got into a weird state in a bank account after trying to purchase a foreign stock (HK) and deleted a lot of lines. So, I decided to reload the datafile, and got this crash. Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". [Thread debugging using libthread_db enabled] [New Thread -1230043456 (LWP 6314)] 0xffffe410 in __kernel_vsyscall ()
+ Trace 67913
Thread 1 (Thread -1230043456 (LWP 6314))
Created attachment 64525 [details] GnuCash file The following appears on the console: ** ERROR **: file Account.c: line 278 (xaccFreeAccount): assertion failed: (acc->splits == NULL)
If you look in /tmp/gnucash.trace I bet you'll see more information.. In particular, I bet you'll see this error: PERR (" instead of calling xaccFreeAccount(), please call \n" " xaccAccountBeginEdit(); xaccAccountDestroy(); \n"); Something is clearly wrong with the destroy path. I suspect this is Chris' fault ;)
Okay, working with Bengt on IRC, this problem happens when the current book is being closed. <bengt> do you want me to do close or quit? <warlord> shouldn't matter <bengt> ** ERROR **: file Account.c: line 278 (xaccFreeAccount): assertion failed: (acc->splits == NULL) I've changed the subject to be a little more accurate.
The step by step procedure to reproduce this one is as follows. 1) Set opening balace to 100,000 HKD into HK Bank 2) Open HK Bank 3) Create a Purchase Split as below HK Bank -50,000 Expenses:Com:HK -1,000 Stock:HK 49,000 ENTER 4) Check the Opening Balance transaction 5) Re open the purchase transaction 6) highlight the stock purchase row, and right click and select Edit Exchange Data 7) Click To Amount 8) Press Cancel 9) Press DELETE 10) Press delete on the headline for this purchase transaction -> do not work 11) File -> Quit (or reload)
the /tmp/gnucash.trace has the following entry Warning: xaccSplitAssignToLot(): split with zero amount; value=0/10000 gflag=ff gsplit=(nil) Error: xaccFreeAccount(): instead of calling xaccFreeAccount(), please call xaccAccountBeginEdit(); xaccAccountDestroy();
In Comment #4, does step 1 mean to create a new account or enter a transaction into an existing account using the register? in step 3) the transaction doesn't balance. Is that intentional? Also, I can't seem to correlate the accounts in the instructions with the accounts in the file. What does step 5 mean? Click the 'Split' toolbar button? Which register mode is this? In step 6, which row is the stock purchase row? I'm not sure what row you mean in step 9. I can see the problem in step 10.
Ok, and in step 11, I chose 'quit w/o saving' and am able to reproduce. Actually, I've been able to reproduce in fewer steps, but steps 9 and 10 seem essential.
Great :) Sorry, it was a bit late when I did all the testing here. (again...) And I did not try to get a small step by step sequence, just trying to be able to reproduce it... :) 3) Create a Purchase Split as below HK Bank -50,000 Expenses:Com:HK 1,000 Stock:HK 49,000 4) Check the Opening Balance transaction 5) Re open the purchase transaction (Click the Split toolbar button, basic ledger) 6) highlight the stock purchase row, and right click and select Edit Exchange Data (stock purchase row = assets:investments:Borkerage Account:Boom:0694.HK) 7) Click To Amount 8) Press Cancel (I regreted setting the number of stocks, so pressed CANCEL) 9) Press DELETE (in the toolbar) Let me know if I should try to explain a bit more :)
Ok, should be fixed in r13883.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=340125. Please update any external references or bookmarks.