]> git.sesse.net Git - vlc/commitdiff
Call libvlc_set_exit_handler() first
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 7 May 2012 16:29:55 +0000 (19:29 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 7 May 2012 16:42:05 +0000 (19:42 +0300)
It should be called before exit can happen.
This restores reverted commit 4d636fa3a74924691b0bb1e26e600f7657e0af5c.

bin/vlc.c

index 46c7d7d6d623b547b0e45a3225fc9692cbbf8943..915163382e3e36c68fc8c8a806873f3ae611f484 100644 (file)
--- 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);