]> git.sesse.net Git - vlc/commitdiff
ncurses: fix crashes when switching boxes
authorPierre Ynard <linkfanel@yahoo.fr>
Thu, 27 Jan 2011 21:24:56 +0000 (22:24 +0100)
committerPierre Ynard <linkfanel@yahoo.fr>
Thu, 27 Jan 2011 21:24:56 +0000 (22:24 +0100)
modules/gui/ncurses.c

index 8bd6241045bfd9685c0c125f5005bcf04b2c092f..23603208f33c2816d5db633d2235e35bce712666 100644 (file)
@@ -1485,7 +1485,7 @@ static bool HandleBrowseKey(intf_thread_t *p_intf, int key)
         playlist_Add(p_playlist, psz_uri, NULL, PLAYLIST_APPEND,
                       PLAYLIST_END, p_parent->p_input == p_input, false);
 
-        p_sys->i_box_type = BOX_PLAYLIST;
+        BoxSwitch(p_sys, BOX_PLAYLIST);
         free(psz_uri);
         return true;
     }
@@ -1625,13 +1625,24 @@ static void HandleCommonKey(intf_thread_t *p_intf, int key)
     case '/': /* Search */
         p_sys->psz_search_chain[0] = '\0';
         p_sys->b_plidx_follow = false;
-        p_sys->i_before_search = p_sys->i_box_idx;
-        p_sys->i_box_type = BOX_SEARCH;
+        if (p_sys->i_box_type == BOX_PLAYLIST)
+        {
+            p_sys->i_before_search = p_sys->i_box_idx;
+            p_sys->i_box_type = BOX_SEARCH;
+        }
+        else
+        {
+            p_sys->i_before_search = 0;
+            BoxSwitch(p_sys, BOX_SEARCH);
+        }
         return;
 
     case 'A': /* Open */
         p_sys->psz_open_chain[0] = '\0';
-        p_sys->i_box_type = BOX_OPEN;
+        if (p_sys->i_box_type == BOX_PLAYLIST)
+            p_sys->i_box_type = BOX_OPEN;
+        else
+            BoxSwitch(p_sys, BOX_OPEN);
         return;
 
     /* Navigation */