]> git.sesse.net Git - vlc/commitdiff
bin/darwinvlc: readd exit handler for the case the macosx interface is not used
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Wed, 12 Feb 2014 14:51:32 +0000 (15:51 +0100)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Wed, 12 Feb 2014 14:54:18 +0000 (15:54 +0100)
bin/darwinvlc.c

index 19d2c58886ec479f2924c167a87b159efbd1f612..0a35dc58914f17960d2f4db113921aade7276fd6 100644 (file)
@@ -55,6 +55,12 @@ static bool signal_ignored (int signum)
             ? (void *)sa.sa_sigaction : (void *)sa.sa_handler) == SIG_IGN;
 }
 
+static void vlc_kill (void *data)
+{
+    pthread_t *ps = data;
+    pthread_kill (*ps, SIGTERM);
+}
+
 static void exit_timeout (int signum)
 {
     (void) signum;
@@ -204,12 +210,15 @@ int main( int i_argc, const char *ppsz_argv[] )
 
     vlc_enable_override ();
 
+    pthread_t self = pthread_self ();
+
     /* Initialize libvlc */
     libvlc_instance_t *vlc = libvlc_new (argc, argv);
     if (vlc == NULL)
         return 1;
 
     int ret = 1;
+    libvlc_set_exit_handler (vlc, vlc_kill, &self);
     libvlc_set_app_id (vlc, "org.VideoLAN.VLC", PACKAGE_VERSION, PACKAGE_NAME);
     libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION);