Transaction API question

Charles Day cedayiv at gmail.com
Mon Feb 9 23:14:38 EST 2009


On Thu, Jan 29, 2009 at 10:28 AM, Charles Day <cedayiv at gmail.com> wrote:

> I have a question about how to destroy a transaction properly. Suppose I do
> the following to create a new transaction with one split.
>
>     new_trans = xaccMallocTransaction (gnc_get_current_book ());
>     xaccTransBeginEdit (new_trans);
>     xaccTransSetCurrency (new_trans,
>                           currency ? currency : gnc_default_currency());
>     xaccTransSetDateSecs (new_trans, info->last_date_entered);
>     blank_split = xaccMallocSplit (gnc_get_current_book ());
>     xaccSplitSetParent(blank_split, new_trans);
>
> I haven't committed yet. Now what if I decide that I don't want this
> transaction or split any more? Will xaccTransRollbackEdit() get that done?
> If not, what is the correct way?
>
> I ask because the register tries to do it with xaccTransDestroy(), but
> since the transaction is still open, that doesn't actually work.
>

Sorry to bump this, but does anyone know the answer? It would help fix bug
346159.


>
> Cheers,
> Charles
>


More information about the gnucash-devel mailing list