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.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9224 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2003-09-05 00:27:20 +00:00
parent 91bf87ec53
commit af4b4a65c2
2 changed files with 33 additions and 0 deletions

View File

@ -1,3 +1,24 @@
2003-09-04 Derek Atkins <derek@ihtfp.com>
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 <hampton@employees.org>
* src/engine/Account.c: Fix bug in computing cleared balance. The

View File

@ -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);