From d1d574e8d9e28b2d01979f30319d06d93f24d99a Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 26 Mar 1998 05:16:37 +0000 Subject: [PATCH] assorted bug fixes git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@736 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/combocell.c | 11 +++++++---- src/register/register.c | 8 +++++++- src/register/table-motif.c | 7 ++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/register/combocell.c b/src/register/combocell.c index 9ca8a495da..37a1904ab3 100644 --- a/src/register/combocell.c +++ b/src/register/combocell.c @@ -99,10 +99,13 @@ void destroyCombo (BasicCell *bcell) box = (PopBox *) (cell->cell.gui_private); - moveCombo (bcell, -1, -1); - - XtDestroyWidget (box->combobox); - free (box); + if (box) { + if (XtIsRealized(box->combobox)) { + moveCombo (bcell, -1, -1); + XtDestroyWidget (box->combobox); + } + free (box); + } /* allow the widget to be created again */ cell->cell.gui_private = NULL; diff --git a/src/register/register.c b/src/register/register.c index 04441df773..7854c9e18d 100644 --- a/src/register/register.c +++ b/src/register/register.c @@ -307,6 +307,7 @@ void xaccInitBasicRegister (BasicRegister *reg, int type) { Table * table; CellBlock *curs, *header; + int phys_r, phys_c; reg->user_hook = NULL; reg->destroy = NULL; @@ -374,8 +375,13 @@ void xaccInitBasicRegister (BasicRegister *reg, int type) /* -------------------------------- */ table = xaccMallocTable (); - xaccSetTableSize (table, header->numRows, header->numCols, 1, 1); + phys_r = header->numRows + curs->numRows; + phys_c = header->numCols; + xaccSetTableSize (table, phys_r, phys_c, 2, 1); xaccSetCursor (table, header, 0, 0, 0, 0); + xaccSetCursor (table, curs, header->numRows, 0, 1, 0); + xaccMoveCursor (table, header->numRows, 0); + reg->table = table; } diff --git a/src/register/table-motif.c b/src/register/table-motif.c index 5ee53de0fb..975b46ec06 100644 --- a/src/register/table-motif.c +++ b/src/register/table-motif.c @@ -555,13 +555,10 @@ xaccCreateTable (Table *table, Widget parent, char * name) haveQuarks = True; } - /* if a header exists, get alignments, widths from there */ + /* The 0'th row of the handlers is defeined as the header */ alignments = NULL; widths = NULL; - curs = table->current_cursor; - if (!curs) { - curs = table->handlers[0][0]; - } + curs = table->handlers[0][0]; alignments = curs->alignments; widths = curs->widths; num_header_rows = curs->numRows;