In GnuCash 1.1.27 (sorry I'm behind) doing `Open Subaccounts' on a
top-level income account that has subaccounts causes a core dump.  I
believe the enclosed patch fixes the bug.

The bug was that in the call of xaccCreateTable() in RegWindow.c the
accRes string pointer array was indexed off the end for several
reasons: 1) the ledger->type field uses the values defined in
splitreg.h while the accRes uses the values defined in register.h and
although the defines have identical names their values are off by one;
2) in the list in register.h the define for CURRENCY_REGISTER was
missing and in RegWindow.c the corresponding string for currency
registers was also missing; 3) finally, there was a duplicate
"regliability" string with no comma at the end causing the string to
be concatenated with the "regincome" string.

I'll upgrade to 1.2.3 or whatever the latest `stable' Motif version is
and see if these bugs have already been fixed.

Index: src/motif/RegWindow.c
===================================================================
RCS file: /usr/local/cvsroot/src/gnu/gnucash/src/motif/RegWindow.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 RegWindow.c
--- RegWindow.c 1999/04/16 00:35:55     1.1.1.2
+++ RegWindow.c 1999/08/22 18:42:14
@@ -69,11 +69,11 @@
   "regasset",
   "regcredit",
   "regliability",
-  "regliability"
   "regincome",
   "regexpense",
   "regequity",
   "regstock",
+  "regcurrency",
   "ledgeneral",
   "ledincome",
   "ledportfolio"
@@ -399,7 +399,7 @@
 
   /* The CreateTable will do the actual gui init, returning a widget */
   reg = xaccCreateTable (ledger->ledger->table, frame, 
-        accRes[(ledger->type & REG_TYPE_MASK)]);
+        accRes[(ledger->type & REG_TYPE_MASK) - 1]);
   regData->reg     = reg;
 
   /* be sure to initialize the gui elements associated with the cursor */
Index: src/register/register.h
===================================================================
RCS file: /usr/local/cvsroot/src/gnu/gnucash/src/register/register.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 register.h
--- register.h  1999/04/15 02:34:22     1.1.1.1
+++ register.h  1999/08/22 18:41:19
@@ -64,10 +64,11 @@
 #define EXPENSE_REGISTER    6
 #define EQUITY_REGISTER     7
 #define STOCK_REGISTER      8
+#define CURRENCY_REGISTER   9
 
-#define GENERAL_LEDGER      9
-#define INCOME_LEDGER       10
-#define PORTFOLIO           11
+#define GENERAL_LEDGER      10
+#define INCOME_LEDGER       11
+#define PORTFOLIO           12
 
 /* modified flags -- indicate how values have been modified */
 #define MOD_NONE  0x000


-- 
Per Bojsen                                        <[EMAIL PROTECTED]>
6132 Lexington Ridge Drive
Lexington, MA 02421-8317
USA

Reply via email to