r18407 - gnucash/trunk/src/gnome-utils - When creating an account selector and a commodity list if provider, just duplicate

Phil Longstaff plongstaff at code.gnucash.org
Sun Nov 8 13:59:41 EST 2009


Author: plongstaff
Date: 2009-11-08 13:59:39 -0500 (Sun, 08 Nov 2009)
New Revision: 18407
Trac: http://svn.gnucash.org/trac/changeset/18407

Modified:
   gnucash/trunk/src/gnome-utils/gnc-account-sel.c
Log:
When creating an account selector and a commodity list if provider, just duplicate
the list rather than making a copy of each commodity.  When a copy is made, this
copy is stored in the db, but is never deleted.  This causes problems (loss of
reference from account/tx to commodity) when the file is reloaded.


Modified: gnucash/trunk/src/gnome-utils/gnc-account-sel.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-account-sel.c	2009-11-01 22:16:30 UTC (rev 18406)
+++ gnucash/trunk/src/gnome-utils/gnc-account-sel.c	2009-11-08 18:59:39 UTC (rev 18407)
@@ -365,24 +365,10 @@
             gas->acctTypeFilters = g_list_copy( typeFilters );
         }
 
+		/* Save the commodity filter list */
         if (commodityFilters)
         {
-            src = commodityFilters;
-
-            while (src->data != NULL)
-            {
-                //gnc_commodity_clone would have been nice but it expects me to 
-                //insert the clone into a book, which I don't want to do.
-                commClone = gnc_commodity_new(qof_session_get_book(gnc_get_current_session()), "","","","",1);
-                gnc_commodity_copy(commClone, src->data);
-                dest = g_list_prepend(dest, commClone);
-                if (src->next == NULL)
-                {
-                    break;
-                }
-                src = src->next;
-            }
-            gas->acctCommodityFilters = dest;
+            gas->acctCommodityFilters = g_list_copy(commodityFilters);
         }
 
         gas_populate_list( gas );



More information about the gnucash-changes mailing list