changeset 33482:7e41f14e7778

Fix segmentation fault when pressing U (stop playing) in GUI. The GUI doesn't make use of playtree_iter, so it can't call the play_tree_iter functions but has to stop in its own way.
author ib
date Tue, 07 Jun 2011 13:17:05 +0000
parents de7945cbcfa0
children 0b572b202b3e
files command.c gui/mplayer/play.c gui/mplayer/play.h playtree.c
diffstat 4 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Tue Jun 07 00:08:06 2011 +0000
+++ b/command.c	Tue Jun 07 13:17:05 2011 +0000
@@ -2963,6 +2963,12 @@
             break;
 
         case MP_CMD_STOP:
+#ifdef CONFIG_GUI
+            // playtree_iter isn't used by the GUI
+            if (use_gui)
+                mplStop();
+            else
+#endif
             // Go back to the starting point.
             while (play_tree_iter_up_step
                    (mpctx->playtree_iter, 0, 1) != PLAY_TREE_ITER_END)
--- a/gui/mplayer/play.c	Tue Jun 07 00:08:06 2011 +0000
+++ b/gui/mplayer/play.c	Tue Jun 07 13:17:05 2011 +0000
@@ -461,3 +461,8 @@
     if (guiIntfStruct.Playing == 1)
         mplEventHandling(evPlay, 0);
 }
+
+void mplStop(void)
+{
+    mplEventHandling(evStop, 0);
+}
--- a/gui/mplayer/play.h	Tue Jun 07 00:08:06 2011 +0000
+++ b/gui/mplayer/play.h	Tue Jun 07 13:17:05 2011 +0000
@@ -33,5 +33,6 @@
 void mplRelSeek(float percent);
 void mplSetFileName(char *dir, char *name, int type);
 void mplState(void);
+void mplStop(void);
 
 #endif /* MPLAYER_GUI_PLAY_H */
--- a/playtree.c	Tue Jun 07 00:08:06 2011 +0000
+++ b/playtree.c	Tue Jun 07 13:17:05 2011 +0000
@@ -506,9 +506,7 @@
 void
 play_tree_iter_free(play_tree_iter_t* iter) {
 
-#ifdef MP_DEBUG
-  assert(iter != NULL);
-#endif
+  if (!iter) return;
 
   if(iter->status_stack) {
 #ifdef MP_DEBUG