Transaction API question

Charles Day cedayiv at gmail.com
Thu Jan 29 13:28:40 EST 2009


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.

Cheers,
Charles


More information about the gnucash-devel mailing list