[vlc-commits] ncurses: fix exit
Rafaël Carré
git at videolan.org
Wed Dec 17 18:40:12 CET 2014
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Dec 17 18:39:29 2014 +0100| [08969c41138ab8b176c2477b7061d0eb0dbb99c3] | committer: Rafaël Carré
ncurses: fix exit
Closes #11877
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=08969c41138ab8b176c2477b7061d0eb0dbb99c3
---
configure.ac | 2 +-
modules/gui/ncurses.c | 15 ++++++++++++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index d3484e7..53ea409 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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}"], [
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index daaa323..d64afd6 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -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);
More information about the vlc-commits
mailing list