[vlc-devel] commit: vlc: Make sure we call libvlc_release() when we are requested to die. (Pierre d'Herbemont )

git version control git at videolan.org
Thu May 15 22:13:25 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Thu May 15 22:13:41 2008 +0200| [68bcb6a4322b55b70c231a597d7b45a5406fd7f8]

vlc: Make sure we call libvlc_release() when we are requested to die.

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.

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

 src/vlc.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/vlc.c b/src/vlc.c
index deaba4b..b1fd2e8 100644
--- 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 */
         {




More information about the vlc-devel mailing list