r2960 - trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src

abraxa at sita.openmoko.org abraxa at sita.openmoko.org
Thu Sep 13 11:07:53 CEST 2007


Author: abraxa
Date: 2007-09-13 11:07:52 +0200 (Thu, 13 Sep 2007)
New Revision: 2960

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c
Log:
No more crashing when creating a playlist after deleting one
"Preliminary title"-flag gets auto-set now, allowing proper metadata handling on tracks whose metadata wasn't set in the playlist yet when the playlist got 
saved



Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c	2007-09-13 06:48:53 UTC (rev 2959)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c	2007-09-13 09:07:52 UTC (rev 2960)
@@ -157,7 +157,10 @@
 	if (omp_playlist)
 	{
 		omp_spiff_free(omp_playlist);
+		omp_playlist = NULL;
+
 		g_free(omp_playlist_file);
+		omp_playlist_file = NULL;
 	}
 
 	// Update session unless no change happened
@@ -222,7 +225,10 @@
 	if (omp_playlist)
 	{
 		omp_spiff_free(omp_playlist);
+		omp_playlist = NULL;
+
 		g_free(omp_playlist_file);
+		omp_playlist_file = NULL;
 	}
 
 	// Create new playlist, save and load it
@@ -251,11 +257,18 @@
 void
 omp_playlist_delete(gchar *playlist_file)
 {
-	if (strcmp(omp_playlist_file, playlist_file) == 0)
+	if (omp_playlist)
 	{
-		omp_spiff_free(omp_playlist);
-		g_free(omp_playlist_file);
-		omp_playback_reset();
+		if (strcmp(omp_playlist_file, playlist_file) == 0)
+		{
+			omp_spiff_free(omp_playlist);
+			omp_playlist = NULL;
+
+			g_free(omp_playlist_file);
+			omp_playlist_file = NULL;
+
+			omp_playback_reset();
+		}
 	}
 
 	g_unlink(playlist_file);
@@ -672,6 +685,14 @@
 	{
 		track->title = g_strdup(title);
 		track->title_is_preliminary = TRUE;
+
+	} else {
+
+		// If there already is a title and it's the same title we *would* set, mark it
+		if (strcmp(track->title, title) == 0)
+		{
+			track->title_is_preliminary = TRUE;
+		}
 	}
 
 	g_free(title);





More information about the commitlog mailing list