Avoid double free of capital gains transactions when quitting

If an register is open on an account that has capital gains transactions
created by the lot scrubber when you quit Gnucash, a capital gains
transaction may be freed twice since it is freed when the associated
sale is freed and again when it is encountered on the list of
transactions to be freed.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21495 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2011-10-28 03:22:41 +00:00
parent 8ba2af23c6
commit 9369eae6d7

View File

@ -1173,8 +1173,10 @@ do_destroy (Transaction *trans)
gboolean shutting_down = qof_book_shutting_down(qof_instance_get_book(trans));
/* If there are capital-gains transactions associated with this,
* they need to be destroyed too. */
destroy_gains (trans);
* they need to be destroyed too unless we're shutting down in
* which case all transactions will be destroyed. */
if (!shutting_down)
destroy_gains (trans);
/* Make a log in the journal before destruction. */
if (!shutting_down)