r17176 - gnucash/branches/gda-dev2/src/backend/gda - When loading commodities, wait until after each commodity has been
Phil Longstaff
plongstaff at cvs.gnucash.org
Mon May 26 21:23:24 EDT 2008
Author: plongstaff
Date: 2008-05-26 21:23:24 -0400 (Mon, 26 May 2008)
New Revision: 17176
Trac: http://svn.gnucash.org/trac/changeset/17176
Modified:
gnucash/branches/gda-dev2/src/backend/gda/gnc-commodity-gda.c
Log:
When loading commodities, wait until after each commodity has been
added to the engine before putting its address on a list used to get
GUIDs to load all slots for the commodities. This is because some
commodities (e.g. national currencies) have already been loaded so the
commodity that was created to load the db info is not the correct
address. This led to strange GUIDs in the SQL and also log messages.
Modified: gnucash/branches/gda-dev2/src/backend/gda/gnc-commodity-gda.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/gda/gnc-commodity-gda.c 2008-05-27 00:52:34 UTC (rev 17175)
+++ gnucash/branches/gda-dev2/src/backend/gda/gnc-commodity-gda.c 2008-05-27 01:23:24 UTC (rev 17176)
@@ -115,7 +115,7 @@
}
static gnc_commodity*
-load_single_commodity( GncGdaBackend* be, GdaDataModel* pModel, int row, GList** pList )
+load_single_commodity( GncGdaBackend* be, GdaDataModel* pModel, int row )
{
QofBook* pBook = be->primary_book;
int col;
@@ -125,8 +125,6 @@
pCommodity = gnc_commodity_new( pBook, NULL, NULL, NULL, NULL, 100 );
gnc_gda_load_object( be, pModel, row, GNC_ID_COMMODITY, pCommodity, col_table );
-// gnc_gda_slots_load( be, QOF_INSTANCE(pCommodity) );
- *pList = g_list_append( *pList, pCommodity );
qof_instance_mark_clean( QOF_INSTANCE(pCommodity) );
@@ -154,13 +152,14 @@
for( r = 0; r < numRows; r++ ) {
gnc_commodity* c;
- pCommodity = load_single_commodity( be, pModel, r, &list );
+ pCommodity = load_single_commodity( be, pModel, r );
if( pCommodity != NULL ) {
GUID guid;
guid = *qof_instance_get_guid( QOF_INSTANCE(pCommodity) );
pCommodity = gnc_commodity_table_insert( pTable, pCommodity );
+ list = g_list_append( list, pCommodity );
qof_instance_set_guid( QOF_INSTANCE(pCommodity), &guid );
}
}
More information about the gnucash-changes
mailing list