GnuCash
Contact   Instructions
Bug 796248 - Editing Scheduled Transaction
Summary: Editing Scheduled Transaction
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Scheduled Transactions (show other bugs)
Version: 3.1
Hardware: Other Linux
: Normal blocker
Target Milestone: future
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords:
: 796249 796568 796834 796866 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-05-18 17:30 EDT by Robin Chattopadhyay
Modified: 2018-09-24 10:41 EDT (History)
10 users (show)

See Also:


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

Description Robin Chattopadhyay 2018-05-18 17:30:44 EDT
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 17:39:16 EDT
*** Bug 796249 has been marked as a duplicate of this bug. ***
Comment 2 Robin Chattopadhyay 2018-05-19 08:07:09 EDT
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 08:04:05 EDT
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 10:10:12 EDT
*** Bug 796568 has been marked as a duplicate of this bug. ***
Comment 5 John Ralls 2018-06-12 15:06:16 EDT
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 18:09:19 EDT
Created attachment 372664 [details]
sample database for demonstrating the bug
Comment 7 Randy Orrison 2018-06-12 18:12:44 EDT
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 18:25:13 EDT
Aha! A SQLite3 database. Withholding evidence...
Comment 9 Randy Orrison 2018-06-12 18:44:13 EDT
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 18:52:25 EDT
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 03:36:18 EDT
That's great news! I can confirm that it works fine now.
Comment 12 Geert Janssens 2018-06-22 04:53:26 EDT
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 05:19:28 EDT
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 05:35:20 EDT
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 13:19:30 EDT
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 19:25:00 EDT
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 03:30:46 EDT
Ah, that's a clever analysis and solution. Works fine now here as well.
Comment 18 Robin Chattopadhyay 2018-06-30 12:41:25 EDT
I built 3.2 from source and installed this morning, but I still am experiencing the same issue.

Version: 3.2
Build ID: 3.2+ (2018-06-24)
Comment 19 John Ralls 2018-06-30 14:09:24 EDT
Yes, unfortunately I had to revert the first fix to prevent Geert's crash. I didn't get the fixed fix committed until after releasing 3.2, so you won't see the fix until 3.3 unless you want to build GnuCash from git.
Comment 20 Robin Chattopadhyay 2018-06-30 16:29:10 EDT
Oh, sorry, I didn't catch that your latest fix was after the 3.2 release. Thanks for the update!
Comment 21 John Ralls 2018-08-29 20:17:28 EDT
*** Bug 796834 has been marked as a duplicate of this bug. ***
Comment 22 John Ralls 2018-09-24 10:41:02 EDT
*** Bug 796866 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.