[MPlayer-cvslog] r33570 - in trunk: command.c gui/mplayer/play.c gui/mplayer/play.h playtree.c

ib subversion at mplayerhq.hu
Tue Jun 7 15:17:06 CEST 2011


Author: ib
Date: Tue Jun  7 15:17:05 2011
New Revision: 33570

Log:
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.

Modified:
   trunk/command.c
   trunk/gui/mplayer/play.c
   trunk/gui/mplayer/play.h
   trunk/playtree.c

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	Tue Jun  7 02:08:06 2011	(r33569)
+++ trunk/command.c	Tue Jun  7 15:17:05 2011	(r33570)
@@ -2963,6 +2963,12 @@ int run_command(MPContext *mpctx, mp_cmd
             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)

Modified: trunk/gui/mplayer/play.c
==============================================================================
--- trunk/gui/mplayer/play.c	Tue Jun  7 02:08:06 2011	(r33569)
+++ trunk/gui/mplayer/play.c	Tue Jun  7 15:17:05 2011	(r33570)
@@ -461,3 +461,8 @@ void mplNext(void)
     if (guiIntfStruct.Playing == 1)
         mplEventHandling(evPlay, 0);
 }
+
+void mplStop(void)
+{
+    mplEventHandling(evStop, 0);
+}

Modified: trunk/gui/mplayer/play.h
==============================================================================
--- trunk/gui/mplayer/play.h	Tue Jun  7 02:08:06 2011	(r33569)
+++ trunk/gui/mplayer/play.h	Tue Jun  7 15:17:05 2011	(r33570)
@@ -33,5 +33,6 @@ void mplPrev(void);
 void mplRelSeek(float percent);
 void mplSetFileName(char *dir, char *name, int type);
 void mplState(void);
+void mplStop(void);
 
 #endif /* MPLAYER_GUI_PLAY_H */

Modified: trunk/playtree.c
==============================================================================
--- trunk/playtree.c	Tue Jun  7 02:08:06 2011	(r33569)
+++ trunk/playtree.c	Tue Jun  7 15:17:05 2011	(r33570)
@@ -506,9 +506,7 @@ play_tree_iter_new(play_tree_t* pt,m_con
 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


More information about the MPlayer-cvslog mailing list