Revision: 1779
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1779&view=rev
Author: teuf
Date: 2007-11-13 12:43:15 -0800 (Tue, 13 Nov 2007)
Log Message:
-----------
* src/itdb_photoalbum.c: fix bug in itdb_photodb_photoalbum_remove,
when removing all the photos from the photodatabase, we were
erasing elements and iterating over the list at the same time,
which resulted in the function not working properly
Modified Paths:
--------------
libgpod/branches/libgpod-0.6/ChangeLog
libgpod/branches/libgpod-0.6/src/itdb_photoalbum.c
Modified: libgpod/branches/libgpod-0.6/ChangeLog
===================================================================
--- libgpod/branches/libgpod-0.6/ChangeLog 2007-11-13 20:13:07 UTC (rev
1778)
+++ libgpod/branches/libgpod-0.6/ChangeLog 2007-11-13 20:43:15 UTC (rev
1779)
@@ -1,3 +1,10 @@
+2007-11-13 Christophe Fergeau <[EMAIL PROTECTED]>
+
+ * src/itdb_photoalbum.c: fix bug in itdb_photodb_photoalbum_remove,
+ when removing all the photos from the photodatabase, we were
+ erasing elements and iterating over the list at the same time,
+ which resulted in the function not working properly
+
====== libgpod 0.6.0 ======
2007-11-10 Christophe Fergeau <[EMAIL PROTECTED]>
Modified: libgpod/branches/libgpod-0.6/src/itdb_photoalbum.c
===================================================================
--- libgpod/branches/libgpod-0.6/src/itdb_photoalbum.c 2007-11-13 20:13:07 UTC
(rev 1778)
+++ libgpod/branches/libgpod-0.6/src/itdb_photoalbum.c 2007-11-13 20:43:15 UTC
(rev 1779)
@@ -687,11 +687,21 @@
* and remove them from the database */
if (remove_pics)
{
- for (it = album->members; it != NULL; it = it->next )
+ GList *pics;
+ /* we can't let itdb_photodb_remove_photo modify album->members
+ * while we're iterating through it, that's it's moved to pics
+ * first. itdb_photodb_remove_photo frees the memory used
+ * by 'photo' so a g_list_free is all we have to do to free
+ * pics memory when we are done iterating
+ */
+ pics = album->members;
+ album->members = NULL;
+ for (it = pics; it != NULL; it = it->next )
{
Itdb_Artwork *photo = it->data;
itdb_photodb_remove_photo (db, NULL, photo);
}
+ g_list_free (pics);
}
db->photoalbums = g_list_remove (db->photoalbums, album);
itdb_photodb_photoalbum_free (album);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2