changeset 35483:8ac7761bcb7c

Clear information associated with a file when setting a new one. This fixes showing wrong information when jumping through the playlist tracks in stop mode.
author ib
date Mon, 03 Dec 2012 14:04:43 +0000
parents 0477dcdcd6d6
children 9dceffa5d9b2
files gui/ui/actions.c gui/ui/gtk/playlist.c
diffstat 2 files changed, 15 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/actions.c	Mon Dec 03 11:50:59 2012 +0000
+++ b/gui/ui/actions.c	Mon Dec 03 14:04:43 2012 +0000
@@ -265,6 +265,8 @@
  * @param dir directory (optional, else NULL)
  * @param name filename
  * @param type stream type of the file
+ *
+ * @note All #guiInfo members associated with the file will be cleared.
  */
 void uiSetFile(char *dir, char *name, int type)
 {
@@ -275,31 +277,29 @@
 
     filename = guiInfo.Filename;
 
-    if (type != SAME_STREAMTYPE)
+    if (type != SAME_STREAMTYPE) {
         guiInfo.StreamType = type;
 
-    nfree(guiInfo.AudioFilename);
-    nfree(guiInfo.SubtitleFilename);
+        guiInfo.VideoWidth    = 0;
+        guiInfo.VideoHeight   = 0;
+        guiInfo.AudioChannels = 0;
+        guiInfo.RunningTime   = 0;
+        guiInfo.Track   = 0;
+        guiInfo.Chapter = 0;
+        guiInfo.Angle   = 0;
+
+        nfree(guiInfo.CodecName);
+        nfree(guiInfo.AudioFilename);
+        nfree(guiInfo.SubtitleFilename);
+    }
 }
 
 /**
  * @brief Unset the file being played.
- *
- * @note Additionally, clear all #guiInfo members associated with the file.
  */
 void uiUnsetFile(void)
 {
     uiSetFile(NULL, NULL, STREAMTYPE_DUMMY);
-
-    nfree(guiInfo.CodecName);
-
-    guiInfo.Track         = 0;
-    guiInfo.Chapter       = 0;
-    guiInfo.Angle         = 0;
-    guiInfo.RunningTime   = 0;
-    guiInfo.AudioChannels = 0;
-    guiInfo.VideoWidth    = 0;
-    guiInfo.VideoHeight   = 0;
 }
 
 /**
--- a/gui/ui/gtk/playlist.c	Mon Dec 03 11:50:59 2012 +0000
+++ b/gui/ui/gtk/playlist.c	Mon Dec 03 14:04:43 2012 +0000
@@ -231,7 +231,6 @@
 	   }
 	  if ( item )
 	   {
-	    uiUnsetFile();
 	    uiSetFile( item->path,item->name,STREAMTYPE_FILE );
 	    guiInfo.NewPlay = GUI_FILE_NEW;
 	    guiInfo.PlaylistNext = (curr.name ? 0 : 1);