GDA: Question about some engine transaction functions

Derek Atkins warlord at MIT.EDU
Mon Mar 31 10:03:59 EDT 2008

Quoting Phil Longstaff <plongstaff at>:

>>> static void
>>> qofTransSetNum (Transaction *trans, const char *xnum)
>>> {
>>>         if (!qof_begin_edit(&trans->inst)) return;
>>>         xaccTransSetNum(trans, xnum);
>>>         qof_commit_edit(&trans->inst);
>>> }
> Actually, I think qof_begin_edit() will return FALSE if passed NULL, so
> it won't crash.

It'll crash in "trans->inst" if trans is NULL.  It wont even get to

> Well, for now, I will use xaccTransSetNum().  I guess a project needs to
> be launched to look into these functions.

Yeah.. Probably a better idea.  Indeed, anywhere there's a qofFooSetBar()
function it pays to look at the xacc/gncFooSetBar() function and see
if it REALLY needs to be changed.  Every once in a while you hit
a place where QOF expects something different than GnuCash, but I
think in MOST cases you can just remove the QOF function and use the
GNC one.  This is one of those times.

But yes, we need a project to clean this up.

> Phil

       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL:    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list