Revision: 1782
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1782&view=rev
Author: jcsjcs
Date: 2007-11-14 07:02:08 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
* src/itdb_photoalbum.c (itdb_photodb_photoalbum_remove): make
sure same photo isn't freed multiple times if it was added in an
album multiple times.
Modified Paths:
--------------
libgpod/trunk/ChangeLog
libgpod/trunk/src/itdb_photoalbum.c
Modified: libgpod/trunk/ChangeLog
===================================================================
--- libgpod/trunk/ChangeLog 2007-11-14 08:30:54 UTC (rev 1781)
+++ libgpod/trunk/ChangeLog 2007-11-14 15:02:08 UTC (rev 1782)
@@ -1,3 +1,9 @@
+2007-11-14 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+ * src/itdb_photoalbum.c (itdb_photodb_photoalbum_remove): make
+ sure same photo isn't freed multiple times if it was added in an
+ album multiple times.
+
2007-11-13 Christophe Fergeau <[EMAIL PROTECTED]>
* src/itdb_photoalbum.c: fix bug in itdb_photodb_photoalbum_remove,
@@ -5,8 +11,6 @@
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]>
* Makefile.am: add README.SysInfo to EXTRADIST
Modified: libgpod/trunk/src/itdb_photoalbum.c
===================================================================
--- libgpod/trunk/src/itdb_photoalbum.c 2007-11-14 08:30:54 UTC (rev 1781)
+++ libgpod/trunk/src/itdb_photoalbum.c 2007-11-14 15:02:08 UTC (rev 1782)
@@ -1,4 +1,4 @@
-/* Time-stamp: <2007-11-03 20:27:36 jcs>
+/*
|
| Copyright (C) 2002-2006 Jorg Schuler <jcsjcs at users sourceforge net>
| Part of the gtkpod project.
@@ -678,8 +678,6 @@
Itdb_PhotoAlbum *album,
gboolean remove_pics)
{
- GList *it;
-
g_return_if_fail (db);
g_return_if_fail (album);
@@ -687,21 +685,16 @@
* and remove them from the database */
if (remove_pics)
{
- 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 )
+ /* we can't iterate over album->members because
+ itdb_photodb_remove_photo() modifies album->members in
+ a not easily predicable way (e.g. @photo may exist in the
+ album several times). Therefore we remove photos until
+ album->members is empty. */
+ while (album->members)
{
- Itdb_Artwork *photo = it->data;
- itdb_photodb_remove_photo (db, NULL, photo);
- }
- g_list_free (pics);
+ Itdb_Artwork *photo = album->members->data;
+ itdb_photodb_remove_photo (db, NULL, photo);
+ }
}
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