This fixes a bug in r14495. The bug is that auto-completed transactions

aren't correctly marked as pending.  This bug is probably responsible for
the crashes like those in bug #348469.

In general, the register makes it very difficult to consistently 
distiguish between beginning to edit a transaction that's being edited 
in another register and beginning to edit the blank transaction, 
which is already open for editing, but isn't marked pending so that
we can pretend it hasn't been opened if it never gets modified.

Fortunately, the auto-completion code only runs on the blank transaction, 
so we can assume it's not being edited in another register.  This patch
goes ahead and marks the blank transaction as pending.
BP



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15004 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker 2006-10-11 00:57:52 +00:00
parent 62e8c9b6df
commit da4829b5c4

View File

@ -676,20 +676,25 @@ gnc_split_register_auto_completion (SplitRegister *reg,
gnc_suspend_gui_refresh ();
/* We are guaranteed to be on the blank trans, so we can
discount the possibility that the current transaction is
being edited in another register. */
/* now perform the completion */
if ((pending_trans != NULL) && (pending_trans != trans)) {
if (gnc_split_register_begin_edit_or_warn(info, trans))
{
gnc_resume_gui_refresh ();
return TRUE;
}
if (xaccTransIsOpen (pending_trans))
xaccTransCommitEdit (pending_trans);
else g_assert_not_reached();
if (pending_trans != trans) {
if (!xaccTransIsOpen(trans))
xaccTransBeginEdit(trans);
/* This is now the pending transaction */
info->pending_trans_guid = *xaccTransGetGUID(trans);
if (pending_trans != NULL) {
if (xaccTransIsOpen (pending_trans))
xaccTransCommitEdit (pending_trans);
else g_assert_not_reached();
}
}
g_assert(xaccTransIsOpen(trans));
pending_trans = trans;
pending_trans = xaccTransLookup(&info->pending_trans_guid,
gnc_get_current_book ());
g_assert(pending_trans == trans);
gnc_copy_trans_onto_trans (auto_trans, trans, FALSE, FALSE);
blank_split = NULL;