r16631 - gnucash/branches/gda-dev/src/backend/gda - 1) Add loaded sx'es properly to the book

Phil Longstaff plongstaff at cvs.gnucash.org
Sun Dec 9 21:31:04 EST 2007


Author: plongstaff
Date: 2007-12-09 21:31:04 -0500 (Sun, 09 Dec 2007)
New Revision: 16631
Trac: http://svn.gnucash.org/trac/changeset/16631

Modified:
   gnucash/branches/gda-dev/src/backend/gda/gnc-schedxaction-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-transaction-gda.c
Log:
1) Add loaded sx'es properly to the book
2) Avoid segmentation fault when loading splits


Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-schedxaction-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-schedxaction-gda.c	2007-12-10 00:08:08 UTC (rev 16630)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-schedxaction-gda.c	2007-12-10 02:31:04 UTC (rev 16631)
@@ -39,6 +39,7 @@
 #include "gnc-slots-gda.h"
 
 #include "SchedXaction.h"
+#include "SX-book.h"
 #include "Recurrence.h"
 
 #include "gnc-recurrence-gda.h"
@@ -189,9 +190,14 @@
         GdaDataModel* pModel = GDA_DATA_MODEL(ret);
         int numRows = gda_data_model_get_n_rows( pModel );
         int r;
+     	SchedXactions *sxes;
+     	sxes = gnc_book_get_schedxactions( be->primary_book );
 
         for( r = 0; r < numRows; r++ ) {
-            (void)load_single_sx( be, pModel, r );
+            SchedXaction* sx;
+			
+			sx = load_single_sx( be, pModel, r );
+		    gnc_sxes_add_sx(sxes, sx);
         }
     }
 }

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-transaction-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-transaction-gda.c	2007-12-10 00:08:08 UTC (rev 16630)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-transaction-gda.c	2007-12-10 02:31:04 UTC (rev 16631)
@@ -476,11 +476,9 @@
     guid = gnc_gda_load_guid( pModel, row );
     split_guid = *guid;
 
+    pSplit = xaccSplitLookup( &split_guid, be->primary_book );
     if( pSplit == NULL ) {
-        pSplit = xaccSplitLookup( &split_guid, be->primary_book );
-        if( pSplit == NULL ) {
-            pSplit = xaccMallocSplit( be->primary_book );
-        }
+        pSplit = xaccMallocSplit( be->primary_book );
     }
 
     /* If the split is dirty, don't overwrite it */



More information about the gnucash-changes mailing list