X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bin%2Fvlc.c;h=085aa3afda453b37dd9cf8422b42c05b5c55c5b3;hb=c60652e38ac6afd74bd8225e9dae5406f13aaa4f;hp=2ed8c6b7219c0901b67e59f79dfc4905bd052baf;hpb=82a5a07b283630b80ef6fcd92f867fb43f8cc042;p=vlc diff --git a/bin/vlc.c b/bin/vlc.c index 2ed8c6b721..085aa3afda 100644 --- a/bin/vlc.c +++ b/bin/vlc.c @@ -74,6 +74,11 @@ static void vlc_kill (void *data) pthread_kill (*ps, SIGTERM); } +static void exit_timeout (int signum) +{ + (void) signum; + signal (SIGINT, SIG_DFL); +} /***************************************************************************** * main: parse command line, start interface and spawn threads. @@ -98,10 +103,6 @@ int main( int i_argc, const char *ppsz_argv[] ) setenv ("GNOME_DISABLE_CRASH_DIALOG", "1", 1); # endif - /* Make Xlib hide visuals with an alphachannel. Ensure that Qt4 will not - * use the alpha channel for the embedded video window. */ - setenv ("XLIB_SKIP_ARGB_VISUALS", "1", 1); - /* Clear the X.Org startup notification ID. Otherwise the UI might try to * change the environment while the process is multi-threaded. That could * crash. Screw you X.Org. Next time write a thread-safe specification. */ @@ -170,11 +171,10 @@ int main( int i_argc, const char *ppsz_argv[] ) pthread_sigmask (SIG_BLOCK, &set, NULL); /* Note that FromLocale() can be used before libvlc is initialized */ - const char *argv[i_argc + 4]; + const char *argv[i_argc + 3]; int argc = 0; argv[argc++] = "--no-ignore-config"; - argv[argc++] = "--user-agent=\"VLC media player\""; #ifdef TOP_BUILDDIR argv[argc++] = FromLocale ("--plugin-path="TOP_BUILDDIR"/modules"); #endif @@ -203,7 +203,9 @@ int main( int i_argc, const char *ppsz_argv[] ) if (vlc == NULL) goto out; -#if !defined (HAVE_MAEMO) + libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION); + +#if !defined (HAVE_MAEMO) && !defined __APPLE__ libvlc_add_intf (vlc, "globalhotkeys,none"); #endif if (libvlc_add_intf (vlc, NULL)) @@ -224,22 +226,24 @@ int main( int i_argc, const char *ppsz_argv[] ) sigwait (&set, &signum); while (signum == SIGCHLD); + /* Restore default signal behaviour after 3 seconds */ + sigemptyset (&set); + sigaddset (&set, SIGINT); + sigaddset (&set, SIGALRM); + signal (SIGINT, SIG_IGN); + signal (SIGALRM, exit_timeout); + pthread_sigmask (SIG_UNBLOCK, &set, NULL); + alarm (3); + /* Cleanup */ out: if (vlc != NULL) libvlc_release (vlc); - for (int i = 2; i < argc; i++) + for (int i = 1; i < argc; i++) LocaleFree (argv[i]); -#ifdef RTLD_NOLOAD - /* Avoid crash in KIO scheduler cleanup. */ - /* This is ugly, but we get way too many crash reports due to this. */ - if (dlopen ("libkio.so.5", RTLD_LAZY|RTLD_LOCAL|RTLD_NOLOAD) != NULL) - { - fprintf (stderr, "KIO present. Unclean shutdown!\n" - " (see http://bugs.kde.org/show_bug.cgi?id=234484 for details)\n"); - _exit (0); - } -#endif - return 0; + /* Do not run exit handlers. Some of them are buggy (e.g. KDE IO scheduler) + * and crash. Also some will crash because their library may be already + * unloaded (dlclose()). */ + _exit (0); }