]> git.sesse.net Git - vlc/commitdiff
vlc: Make sure we call libvlc_release() when we are requested to die.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 15 May 2008 20:13:41 +0000 (22:13 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 15 May 2008 20:13:41 +0000 (22:13 +0200)
Note: I don't think we did yet match the old behaviour, if we hit ctrl-c while in libvlc_new(), vlc isn't killed properly.

src/vlc.c

index deaba4bedfb2d52fd66ef234236da049be2766cb..b1fd2e8b6ce217da5d446dde44428345d0a4546e 100644 (file)
--- a/src/vlc.c
+++ b/src/vlc.c
@@ -56,6 +56,9 @@ extern void __wgetmainargs(int *argc, wchar_t ***wargv, wchar_t ***wenviron,
 static void *SigHandler (void *set);
 #endif
 
+/* running vlc instance */
+static libvlc_instance_t * vlc = NULL;
+
 /*****************************************************************************
  * main: parse command line, start interface and spawn threads.
  *****************************************************************************/
@@ -184,7 +187,7 @@ int main( int i_argc, const char *ppsz_argv[] )
     libvlc_exception_init (&ex);
 
     /* Initialize libvlc */
-    libvlc_instance_t *vlc = libvlc_new (i_argc, ppsz_argv, &ex);
+    vlc = libvlc_new (i_argc, ppsz_argv, &ex);
     if (vlc != NULL)
     {
         libvlc_run_interface (vlc, NULL, &ex);
@@ -252,7 +255,7 @@ static void *SigHandler (void *data)
 
             fprintf (stderr, "signal %d received, terminating vlc - do it "
                             "again quickly in case it gets stuck\n", i_signal);
-            //VLC_Die( 0 );
+            if (vlc) libvlc_release( vlc );
         }
         else /* time (NULL) <= abort_time */
         {