r17864 - gnucash/branches/2.2/src/register/ledger-core - [17853] Bug #435642: Fix crash when editing results of a find
Christian Stimming
cstim at cvs.gnucash.org
Sat Jan 31 05:46:19 EST 2009
Author: cstim
Date: 2009-01-31 05:46:19 -0500 (Sat, 31 Jan 2009)
New Revision: 17864
Trac: http://svn.gnucash.org/trac/changeset/17864
Modified:
gnucash/branches/2.2/src/register/ledger-core/split-register-util.c
Log:
[17853] Bug #435642: Fix crash when editing results of a find
I finally got around to looking into this some more. I think the problem is a
result of an interaction between gnc_split_register_redraw and
gnc_split_register_find_split when called from gnc_split_register_move_cursor
in split-register-control.c. As the comment says, "redrawing the register can
muck everything up". In particular calling gnc_split_register_redraw may
change the "transaction split" for some or all of the transactions if the
register is a "ledger" style register such as the one for find results. This
causes the subsequent call to gnc_split_register_find_split to find the wrong
register row if the cursor class being found is CURSOR_CLASS_TRANS. Whether
this causes a crash seems to depend on circumstances I haven't quite figured
out, but I have one test file that crashes 100% of the time in r17804.
This patch changes the way gnc_split_register_find_split works when asked to
find the transaction split for a transaction. It assumes that any transaction
can only have one such split and returns as soon as it finds a row containing
it. If you think this is wrong, let me know and I'll try something else.
Patch by Mike Alexander.
Modified: gnucash/branches/2.2/src/register/ledger-core/split-register-util.c
===================================================================
--- gnucash/branches/2.2/src/register/ledger-core/split-register-util.c 2009-01-31 10:46:12 UTC (rev 17863)
+++ gnucash/branches/2.2/src/register/ledger-core/split-register-util.c 2009-01-31 10:46:19 UTC (rev 17864)
@@ -221,11 +221,21 @@
cursor_class = gnc_split_register_get_cursor_class (reg, vc_loc);
if (t == trans)
+ {
found_trans = TRUE;
+
+ if (cursor_class == CURSOR_CLASS_TRANS)
+ {
+ found_trans_split = TRUE;
+ if (find_class == CURSOR_CLASS_TRANS)
+ {
+ if (vcell_loc != NULL)
+ *vcell_loc = vc_loc;
+ return TRUE;
+ }
+ }
+ }
- if ((cursor_class == CURSOR_CLASS_TRANS) && (s == trans_split))
- found_trans_split = TRUE;
-
if (found_trans && (s == split) && s)
{
if (vcell_loc != NULL)
More information about the gnucash-changes
mailing list