Bug 666329 should block release of 2.4.9

John Ralls jralls at ceridwen.us
Tue Jan 3 13:19:56 EST 2012


On Jan 2, 2012, at 5:53 PM, Derek Atkins wrote:

> 
> On Mon, January 2, 2012 8:31 pm, John Ralls wrote:
>> 
>> On Jan 2, 2012, at 4:53 PM, Derek Atkins wrote:
>> 
>>> Um,
>>> 
>>> Why is the autosave even kicking in with a SQL backend?  There's no need
>>> for it.  If we're using SQL, autosave should not even run.
>>>> Also, I think that the autosave function should be
>>>> moved out of gnome-utils into backend/xml, since it isn't really
>>>> appropriate for the SQL backends which are supposed to save everything
>>>> as
>>>> part of a commitEdit.
>> 
>> I think we agree there...
>> 
>> I guess the reason it's kicking is is that something marks the book dirty
>> (which starts the timer) and the SQL backend doesn't mark the book clean
>> when it commits, so the timer doesn't get stopped.
> 
> That sounds like the bug there -- why is the SQL backend not marking the
> book clean after it commits?  What is being marked dirty?

No, it's not *the* bug. It's one of the bugs.

I don't know yet. gnc_sql_commit_edit() calls qof_book_mark_clean() at the end, so it's going through another execution path.
No, wait, Hah! I see it:
   qof_instance_mark_clean (instance);
   qof_book_mark_saved (book);

qof_book_mark_saved() only calls the callback (which unsets the timer) if the dirty flag is set. If the instance being committed is the book (as it would be in all cases where the book was marked dirty), then marking the instance clean unsets the flag without resetting the timer and preventing the timer from being reset in the following call.

This illustrates nicely the pitfalls of half-assed OO implementation: Book is a subclass of qofinstance, so gnc_sql_commit_edit() *should* be able to call instance->mark_clean and the polymorphic magic would automatically call the correct subclass function. Because the class inheritance isn't correctly implemented in Gnucash, that doesn't work.

The book is being marked dirty, obviously: That's what starts the autosave timer. The functions that mark the book dirty are qof_book_kvp_changed(), qof_book_increment_and_format_counter(), qof_book_set_string_option(), and gnc_ab_set_book_template_list(), all in the context of begin_edit(), do_stuff, mark_dirty(), commit_edit().

This illustrates another problem: Only functions which use one of those four calls initiate the autosave behavior. There are a lot of edits that don't touch any of that, so autosave isn't going to be very reliable except for business users (because of counters).

Regards,
John Ralls




More information about the gnucash-devel mailing list