diff --git a/ChangeLog b/ChangeLog index 7df63471cf..e8625a63c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2003-09-04 Derek Atkins + + Apply Nigel Titley's patch to fix #103174: + * src/register/register-core/basiccell.c: + - add some debugging messages + - don't kill ourself if we're asked to set the value to our own value. + + Description of the problem from Nigel: + + The problem is that the SX formula_cell stuff calls (via an + intermediate step) + + gnc_basic_cell_set_value_internal (BasicCell *cell, const char *value) + + with value pointing at cell->value. The overall effect of this as far + as gnc_basic_cell_set_value_internal is concerned is to trash the value + stored in cell->value *before* re-writing back to the same place (the + g_free() writes memory management stuff in the first few bytes of the + value). This is what trashes the debit/credit value in the SX register + entry. + 2003-08-29 David Hampton * src/engine/Account.c: Fix bug in computing cleared balance. The diff --git a/src/register/register-core/basiccell.c b/src/register/register-core/basiccell.c index 2947fc773f..8477416ec2 100644 --- a/src/register/register-core/basiccell.c +++ b/src/register/register-core/basiccell.c @@ -42,6 +42,8 @@ #include "dialog-utils.h" #include "gnc-engine-util.h" +/* Debugging module */ +static short module = MOD_REGISTER; gboolean gnc_cell_name_equal (const char * cell_name_1, @@ -105,6 +107,7 @@ gnc_basic_cell_init (BasicCell *cell) void gnc_basic_cell_destroy (BasicCell *cell) { + ENTER(" "); if (cell->destroy) cell->destroy (cell); @@ -124,6 +127,7 @@ gnc_basic_cell_destroy (BasicCell *cell) /* free the object itself */ g_free (cell); + LEAVE(" "); } void @@ -243,6 +247,14 @@ gnc_basic_cell_set_value_internal (BasicCell *cell, const char *value) if (value == NULL) value = ""; + /* If the caller tries to set the value with our own value then do + * nothing because we have no work to do (or, at least, all the work + * will result in the status-quo, so why do anything?) See bug + * #103174 and the description in the changelog on 2003-09-04. + */ + if (cell->value == value) + return; + g_free (cell->value); cell->value = g_strdup (value);