mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
Register: Fix a memory leak by adding a "commit" step (if needed) when destroying the blank transaction as the register closes.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17895 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -2519,6 +2519,8 @@ gnc_split_register_cleanup (SplitRegister *reg)
|
||||
/* 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 @@ gnc_split_register_cleanup (SplitRegister *reg)
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user