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 796248 - Editing Scheduled Transaction
Editing Scheduled Transaction
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Scheduled Transactions
3.1
Other Linux
: Normal blocker
: future
Assigned To: gnucash-core-maint
gnucash-core-maint
: 796249 796568 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2018-05-18 21:30 UTC by Robin Chattopadhyay
Modified: 2018-08-09 13:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sample database for demonstrating the bug (220.00 KB, application/x-gnucash)
2018-06-12 22:09 UTC, Randy Orrison
Details
Sqlite based book containing business data which results in an abrt. (124.00 KB, application/octet-stream)
2018-06-22 08:53 UTC, Geert Janssens
Details
Stacktrace from crash (8.40 KB, text/plain)
2018-06-22 09:19 UTC, Geert Janssens
Details

Description Robin Chattopadhyay 2018-05-18 21:30:40 UTC
Under Edit Scheduled Transaction, click Template Transaction, attempt to edit a value in any field of the transaction then move focus to another line throws an error: "This transaction is already being edited in another register. Please finish editing it there first."

Since it's a scheduled transaction, it seems illogical for the transaction to be open in another register.

The workaround is to delete the transaction from the SX editor window and re-add it, but this is not ideal because many of my SXs have multiple transactions in a particular order.
Comment 1 John Ralls 2018-05-18 21:39:12 UTC
*** Bug 796249 has been marked as a duplicate of this bug. ***
Comment 2 Robin Chattopadhyay 2018-05-19 12:07:05 UTC
Additional steps to recreate:

Create new SX; close GnuCash; re-open GnuCash. Edit SX template transaction.

I tried: 
*Create SX; edit template. Editing allowed
*Create SX; Run SX; edit template. Editing allowed
*Create SX; Run SX; Close/re-open Gnucash. Editing NOT allowed
*Create SX; Close/re-open Gnucash. Editing NOT allowed
Comment 3 Randy Orrison 2018-05-21 12:04:01 UTC
I'm getting the same error, on Windows 10.  Version 3.1, build 3.0-118-gd2ef5fd0f+ (2018-04-28)
Comment 4 John Ralls 2018-06-12 14:10:08 UTC
*** Bug 796568 has been marked as a duplicate of this bug. ***
Comment 5 John Ralls 2018-06-12 19:06:12 UTC
I can't replicate this at all, there must be something about the transaction. Can someone post and example SX that exhibits the problem?
Comment 6 Randy Orrison 2018-06-12 22:09:15 UTC
Created attachment 372664 [details]
sample database for demonstrating the bug
Comment 7 Randy Orrison 2018-06-12 22:12:40 UTC
The attached database was created from scratch.  I created a transaction in the Cash in Wallet account, scheduled it, closed and reopened to create one transaction at startup.  I've closed and re-opened since then.

In the database as is, go into Actions, Scheduled Transactions, Scheduled Transaction Editor.
Double-click the single transaction in the list.
Click on the Template Transaction tab.
Change the Debit Formula amount to 5, and hit enter.
Comment 8 John Ralls 2018-06-12 22:25:09 UTC
Aha! A SQLite3 database. Withholding evidence...
Comment 9 Randy Orrison 2018-06-12 22:44:09 UTC
You should know from bug 796369 that I'm using sqlite.

:-)

Sorry - in hindsight it's obvious that I should have included it in comment 3.
Comment 10 John Ralls 2018-06-12 22:52:21 UTC
And with that one little bit of extra information, the fix is in. It will be in tomorrow's nightly and in 3.2.
Comment 11 Alen Siljak 2018-06-13 07:36:14 UTC
That's great news! I can confirm that it works fine now.
Comment 12 Geert Janssens 2018-06-22 08:53:22 UTC
Created attachment 372752 [details]
Sqlite based book containing business data which results in an abrt.

Unfortunately this commit now causes gnucash to abort when loading business data from an sqlite based book. I can consistently make it crash with the attached sample book on Fedora 27.

A git bisect reveals https://github.com/Gnucash/gnucash/commit/ffe6044cd66edf39ae22875ef475d8e655b93526 (the fix for this bug) as the source of the abort.
Comment 13 Geert Janssens 2018-06-22 09:19:24 UTC
Created attachment 372754 [details]
Stacktrace from crash

I did a clean rebuild of gnucash on the bad commit and ran it through gdb to create this stacktrace.

It aborts in gnc_split_set_property. This particular call to gnc_split_set_property attempts to (re)set the parent of the split. But there's a guard that if the split parent exists it should be marked for editing. This assumption if clearly false in this case. It used to be true before this commit due to the extra xaccTransBeginEdit that got removed in this commit.

I'm not sure how this should be handled.
I hoped that skipping the assert in case the property to set is PROP_TX would fix this. It does fix this particular assert but it will crash on the next property for the same split as the parent is still not in the correct edit level.

Instead of asserting on the correct edit level, shouldn't we just increase and decrease the edit level ourselves here ? But that may create a performance bottleneck...
Comment 14 Geert Janssens 2018-06-22 09:35:16 UTC
As it's a crasher now I'm raising severity. If we don't find the proper solution before 3.2, we probably should revert this commit and pick up the issue again for 3.3 because a crash is worse than not being able to change an SX in an sql based book.
Comment 15 John Ralls 2018-06-22 17:19:26 UTC
I agree and I've reverted that commit. I suspect that the problem here is that there aren't any splits in a template transaction; the split information lives in slots attached to the transaction. Either the BeginEdit needs to be conditional on the transaction not being a template transaction or there needs to be a corresponding CommitEdit for template transactions somewhere.
Comment 16 John Ralls 2018-06-26 23:24:56 UTC
I've redone removing the extra xaccTransBeginEdit and avoided the problem of the assert while re-adding the splits by checking the splits to see if they're loaded already so that they're loaded only once.
Comment 17 Geert Janssens 2018-06-27 07:30:42 UTC
Ah, that's a clever analysis and solution. Works fine now here as well.
Comment 18 John Ralls 2018-06-30 00:10:29 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=796248. Please update any external references or bookmarks.
Comment 19 Fredrik Olofsson 2018-08-09 12:34:57 UTC
Hello,

The bug still exists if you are using a mysql-database. Precisely the error reported here, only difference is that I'm not using a sqlite-db, but a mysql one.

Cheers,

Fredrik
Comment 20 Fredrik Olofsson 2018-08-09 12:36:00 UTC
(In reply to Fredrik Olofsson from comment #19)
> Hello,
> 
> The bug still exists if you are using a mysql-database. Precisely the error
> reported here, only difference is that I'm not using a sqlite-db, but a
> mysql one.
> 
> Cheers,
> 
> Fredrik

Sorry for spamming,

Guess I should have said that I'm on Gnucash 3.2 Official on MacOS. 

Cheers,

Fredrik
Comment 21 Alen Siljak 2018-08-09 13:39:56 UTC
Strange that this site is still editable. Fredrick, please read the post above yours.
This fix has been reverted for 3.2 and will be released in 3.3.