[vlc-commits] Call libvlc_set_exit_handler() first

Rémi Denis-Courmont git at videolan.org
Mon May 7 18:58:19 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May  7 19:29:55 2012 +0300| [74258e6c1264e04966c3fe6e9a87d43417bf9726] | committer: Rémi Denis-Courmont

Call libvlc_set_exit_handler() first

It should be called before exit can happen.
This restores reverted commit 4d636fa3a74924691b0bb1e26e600f7657e0af5c.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74258e6c1264e04966c3fe6e9a87d43417bf9726
---

 bin/vlc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/bin/vlc.c b/bin/vlc.c
index 46c7d7d..9151633 100644
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -166,6 +166,7 @@ int main( int i_argc, const char *ppsz_argv[] )
     sigaddset (&set, SIGCHLD);
 
     /* Block all these signals */
+    pthread_t self = pthread_self ();
     pthread_sigmask (SIG_SETMASK, &set, NULL);
 
     const char *argv[i_argc + 2];
@@ -193,6 +194,7 @@ int main( int i_argc, const char *ppsz_argv[] )
     if (vlc == NULL)
         goto out;
 
+    libvlc_set_exit_handler (vlc, vlc_kill, &self);
     libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION);
 
 #if !defined (HAVE_MAEMO) && !defined __APPLE__ && !defined (__OS2__)
@@ -207,10 +209,6 @@ int main( int i_argc, const char *ppsz_argv[] )
 
     libvlc_playlist_play (vlc, -1, 0, NULL);
 
-    /* Wait for a termination signal */
-    pthread_t self = pthread_self ();
-    libvlc_set_exit_handler (vlc, vlc_kill, &self);
-
     /* Qt4 insists on catching SIGCHLD via signal handler. To work around that,
      * unblock it after all our child threads are created. */
     sigdelset (&set, SIGCHLD);



More information about the vlc-commits mailing list