[vlc-devel] [vlc-commits] macosx: implement libvlc exit handler to properly terminate the app when requested

Rafaël Carré funman at videolan.org
Wed Feb 12 08:54:27 CET 2014


Hello,

On 02/03/14 15:18, David Fuhrmann wrote:
> vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Feb  2 18:18:07 2014 +0100| [f36dcf5a5cfeb0b7af7035f3dc95aab75a3a1fa5] | committer: David Fuhrmann
> 
> macosx: implement libvlc exit handler to properly terminate the app when requested
> 
> This is the only supported way to terminate an cocoa application and also ensure
> that the gui settings are getting saved. Adapted from similar code in the qt
> module.
> 
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f36dcf5a5cfeb0b7af7035f3dc95aab75a3a1fa5
> ---
> 
>  bin/darwinvlc.c           |    8 --------
>  modules/gui/macosx/intf.m |    9 +++++++++
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/bin/darwinvlc.c b/bin/darwinvlc.c
> index 7b2db9d..40bd983 100644
> --- a/bin/darwinvlc.c
> +++ b/bin/darwinvlc.c
> @@ -55,12 +55,6 @@ 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;
> @@ -148,7 +142,6 @@ 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 + 3];
> @@ -217,7 +210,6 @@ int main( int i_argc, const char *ppsz_argv[] )
>          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);
>  

That code should not be removed, else we don't have an exit handler in
case the osx
interface is not used (e.g. -I dummy, -I rc, etc).



More information about the vlc-devel mailing list