[Gnucash-changes] r12197 - gnucash/trunk/src/engine - remove random qof_commit_edit from xaccSplitSetSlots_nc

Chris Shoemaker c.shoemaker at cox.net
Thu Dec 29 11:05:35 EST 2005


On Thu, Dec 29, 2005 at 10:01:14AM -0500, Derek Atkins wrote:
> Quoting Chris Shoemaker <c.shoemaker at cox.net>:
> 
> >On Thu, Dec 29, 2005 at 12:27:21AM -0500, Derek Atkins wrote:
> >>If it's unbalanced, the proper fix here is to add a begin_edit,
> >>not to remove the commit_edit.
> >
> >Nope.  SplitSetters don't do their own begin/commit.  It's a
> >bug.
> >
> >-chris
> 
> The problem is that the engine needs to ASSURE that the split (well,
> Transaction in this case) is marked dirty when the KVP is modified.

_None_ of the SplitSetters currently do this.  But, if we want
SplitSetters to dirty their transaction then we should follow the
example in Account.c: dirty it directly in the mark_split(), and make
sure the setters call mark_split().  (Half of them already do, but
mark_split() doesn't dirty the transaction.)

> The way you mark an object as dirty is to perform a begin_edit/commit_edit
> pair.    

Unreliable.  Only works if there's no backend or no backend begin
hook.  'obj.inst.dirty = TRUE' seems to be the common way to
accomplish this reliably.  Anyway, even if it did work why on earth
would we want to confuse the transactional semantics with dirtying
semantics.

> And yes, SplitSetters DO do their own begin/commit, 

Umm... no function xaccSplitSet* calls any begin or commit functions.
Perhaps you're thinking of the private qof setter helpers that wrap
xaccSplitSet*?  Or maybe you're assuming that SplitSetters work the
same way as AccountSetters?

> to make
> sure that the object gets marked dirty in case the caller of the API
> neglects to begin/commit themselves.

Well, they don't, but we should just mark them dirty.

> This is also why we handle nested begin/commit calls.

I understand the need for nesting, but I don't think it's related.  At
least, it's not _supposed_ to be.  It's supposed to make sense to call
begin_edit, then not really edit, then call commit_edit, and be able
to realize that there's nothing to do because we're not dirty.

-chris


More information about the gnucash-devel mailing list