r17894 - gnucash/trunk/src/register/ledger-core - Bug 426111: Register: Fix a bug that caused the blank split GUID to be nulled even if the split wasn't actually being committed. This would cause the bottom transaction of the register to be treated like an existing transaction instead of a new one. I've fixed that and reorganized the logic to combine two sections and make it harder to get them out of sync.

Charles Day cedayiv at cvs.gnucash.org
Wed Feb 11 18:07:51 EST 2009


Author: cedayiv
Date: 2009-02-11 18:07:51 -0500 (Wed, 11 Feb 2009)
New Revision: 17894
Trac: http://svn.gnucash.org/trac/changeset/17894

Modified:
   gnucash/trunk/src/register/ledger-core/split-register.c
Log:
Bug 426111: Register: Fix a bug that caused the blank split GUID to be nulled even if the split wasn't actually being committed. This would cause the bottom transaction of the register to be treated like an existing transaction instead of a new one. I've fixed that and reorganized the logic to combine two sections and make it harder to get them out of sync.


Modified: gnucash/trunk/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register.c	2009-02-11 22:11:30 UTC (rev 17893)
+++ gnucash/trunk/src/register/ledger-core/split-register.c	2009-02-11 23:07:51 UTC (rev 17894)
@@ -1384,7 +1384,6 @@
    const char *memo;
    const char *desc;
    Split *split;
-   gboolean blank_edited = FALSE;
 
    ENTER("reg=%p, do_commit=%s", reg, do_commit ? "TRUE" : "FALSE");
 
@@ -1428,32 +1427,33 @@
        return FALSE;
      }
 
-     gnc_suspend_gui_refresh ();
+     if (trans == pending_trans ||
+         (trans == blank_trans && info->blank_split_edited)) {
+       /* We are going to commit. */
 
-     if (trans == blank_trans) {
-         blank_edited = info->blank_split_edited;
-         info->last_date_entered = xaccTransGetDate (trans);
-         /* Q: Why should we nullify the blank split GUID if the blank split
-          *    wasn't edited? We still might not be committing! */
-         info->blank_split_guid = *guid_null ();
-         info->blank_split_edited = FALSE;
-     }
+       gnc_suspend_gui_refresh ();
 
-     /* We have to clear the pending guid *before* committing the
-        trans, because the event handler will find it otherwise. */
-     if (trans == pending_trans) { 
-         info->pending_trans_guid = *guid_null ();
+       if (trans == blank_trans) {
+           /* We have to clear the blank split before the
+            * refresh or a new one won't be created. */
+           info->last_date_entered = xaccTransGetDate (trans);
+           info->blank_split_guid = *guid_null ();
+           info->blank_split_edited = FALSE;
+       }
+
+       /* We have to clear the pending guid *before* committing the
+        * trans, because the event handler will find it otherwise. */
+       if (trans == pending_trans)
+           info->pending_trans_guid = *guid_null ();
+
+       PINFO("committing trans (%p)", trans);
+       xaccTransCommitEdit(trans);
+
+       gnc_resume_gui_refresh ();
      }
-     
-     if (trans == pending_trans || blank_edited) {
-         PINFO("committing trans (%p)", trans);
-         xaccTransCommitEdit(trans);
-     }
      else
        DEBUG("leaving trans (%p) open", trans);
 
-     gnc_resume_gui_refresh ();
-
      LEAVE("unchanged cursor");
      return TRUE;
    }



More information about the gnucash-changes mailing list