Commit 08969c41 authored by Rafaël Carré's avatar Rafaël Carré

ncurses: fix exit

Closes #11877
parent 868f5b89
......@@ -3792,7 +3792,7 @@ AS_IF([test "${enable_ncurses}" != "no"] ,[
PKG_CHECK_MODULES([NCURSES], [ncursesw], [
VLC_ADD_PLUGIN([ncurses])
VLC_ADD_CFLAGS([ncurses],[${NCURSES_CFLAGS}])
VLC_ADD_LIBS([ncurses],[${NCURSES_LIBS}])
VLC_ADD_LIBS([ncurses],[${NCURSES_LIBS} ${LIBPTHREAD}])
ALIASES="${ALIASES} nvlc"
], [
AS_IF([test -n "${enable_ncurses}"], [
......
......@@ -1795,6 +1795,15 @@ static inline void UpdateInput(intf_sys_t *sys, playlist_t *p_playlist)
}
}
static void cleanup_run(void *data)
{
intf_thread_t *intf = data;
playlist_t *p_playlist = pl_Get(intf);
var_DelCallback(p_playlist, "intf-change", PlaylistChanged, intf);
var_DelCallback(p_playlist, "item-change", ItemChanged, intf);
var_DelCallback(p_playlist, "playlist-item-append", PlaylistChanged, intf);
}
/*****************************************************************************
* Run: ncurses thread
*****************************************************************************/
......@@ -1808,15 +1817,14 @@ static void *Run(void *data)
var_AddCallback(p_playlist, "item-change", ItemChanged, intf);
var_AddCallback(p_playlist, "playlist-item-append", PlaylistChanged, intf);
vlc_cleanup_push(cleanup_run, data);
while (!sys->exit) {
UpdateInput(sys, p_playlist);
Redraw(intf);
HandleKey(intf);
}
vlc_cleanup_pop();
var_DelCallback(p_playlist, "intf-change", PlaylistChanged, intf);
var_DelCallback(p_playlist, "item-change", ItemChanged, intf);
var_DelCallback(p_playlist, "playlist-item-append", PlaylistChanged, intf);
return NULL;
}
......@@ -1881,6 +1889,7 @@ static void Close(vlc_object_t *p_this)
{
intf_sys_t *sys = ((intf_thread_t*)p_this)->p_sys;
vlc_cancel(sys->thread);
vlc_join(sys->thread, NULL);
PlaylistDestroy(sys);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment