[vlc-commits] commit: Work around cleanup handler bug in kfile plugin ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sat Mar 27 15:32:06 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 27 16:20:28 2010 +0200| [9cca111d2805ecab4ddcb646703c1852f9717a7b] | committer: Rémi Denis-Courmont 

Work around cleanup handler bug in kfile plugin

Parental advisory: explicit hack.

If kfilemodule is loaded, bypass run cleanup handlers. Library really
should not use this C feature in any case (IMHO). And I find it
outright idiotic for a (Qt4) plugin to use cleanup handlers.
This is causing so many crash reports that it's not funny anymore:
https://bugs.launchpad.net/ubuntu/+source/vlc/+bug/408719

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

 bin/Makefile.am |    2 ++
 bin/vlc.c       |   10 ++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/bin/Makefile.am b/bin/Makefile.am
index 2bb4294..69e3773 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -46,6 +46,8 @@ vlc_static_LDFLAGS = $(vlc_LDFLAGS) -no-install -static
 if HAVE_WIN32
 vlc_LDADD += -lwininet vlc_win32_rc.$(OBJEXT)
 vlc_DEPENDENCIES += vlc_win32_rc.$(OBJEXT)
+else
+vlc_LDADD += -ldl
 endif
 
 .rc.in.rc: $(top_builddir)/config.status
diff --git a/bin/vlc.c b/bin/vlc.c
index 182a7ed..1c64656 100644
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -47,6 +47,7 @@ extern char *FromLocale (const char *);
 #include <time.h>
 #include <pthread.h>
 #include <unistd.h>
+#include <dlfcn.h>
 
 /*****************************************************************************
  * main: parse command line, start interface and spawn threads.
@@ -172,5 +173,14 @@ int main( int i_argc, const char *ppsz_argv[] )
     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 ("libkfilemodule.so", RTLD_LAZY|RTLD_LOCAL|RTLD_NOLOAD) != NULL)
+    {
+        fprintf (stderr, "KFile plugin present. Unclean shutdown!\n");
+        _exit (0);
+    }
+#endif
     return 0;
 }



More information about the vlc-commits mailing list