r17895 - gnucash/trunk/src/register/ledger-core - Register: Fix a memory leak by adding a "commit" step (if needed) when destroying the blank transaction as the register closes.

Charles Day cedayiv at cvs.gnucash.org
Thu Feb 12 00:18:14 EST 2009


Author: cedayiv
Date: 2009-02-12 00:18:14 -0500 (Thu, 12 Feb 2009)
New Revision: 17895
Trac: http://svn.gnucash.org/trac/changeset/17895

Modified:
   gnucash/trunk/src/register/ledger-core/split-register.c
Log:
Register: Fix a memory leak by adding a "commit" step (if needed) when destroying the blank transaction as the register closes.


Modified: gnucash/trunk/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register.c	2009-02-11 23:07:51 UTC (rev 17894)
+++ gnucash/trunk/src/register/ledger-core/split-register.c	2009-02-12 05:18:14 UTC (rev 17895)
@@ -2519,6 +2519,8 @@
    /* be sure to destroy the "blank split" */
    if (blank_split != NULL)
    {
+      gboolean was_open;
+
       /* split destroy will automatically remove it
        * from its parent account */
       blank_trans = xaccSplitGetParent (blank_split);
@@ -2533,7 +2535,10 @@
         pending_trans = NULL;
       }
 
+      was_open = xaccTransIsOpen (blank_trans);
       xaccTransDestroy (blank_trans);
+      if (was_open)
+        xaccTransCommitEdit (blank_trans);
 
       info->blank_split_guid = *guid_null ();
       blank_split = NULL;



More information about the gnucash-changes mailing list