[vlc-commits] commit: Safety checks for X11 error handlers ( Rémi Denis-Courmont )
git at videolan.org
git at videolan.org
Sun Apr 11 18:52:52 CEST 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 11 19:52:34 2010 +0300| [209c152e39ae22bf3842ff81f5b829c099d3aae7] | committer: Rémi Denis-Courmont
Safety checks for X11 error handlers
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=209c152e39ae22bf3842ff81f5b829c099d3aae7
---
bin/override.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/bin/override.c b/bin/override.c
index c6084d8..113a638 100644
--- a/bin/override.c
+++ b/bin/override.c
@@ -192,6 +192,43 @@ int sigaction (int signum, const struct sigaction *act, struct sigaction *old)
}
+/*** Xlib ****/
+#ifdef HAVE_X11_XLIB_H
+# include <X11/Xlib.h>
+
+static pthread_mutex_t xlib_lock = PTHREAD_MUTEX_INITIALIZER;
+
+int (*XSetErrorHandler (int (*handler) (Display *, XErrorEvent *)))
+ (Display *, XErrorEvent *)
+{
+ if (override)
+ {
+ int (*ret) (Display *, XErrorEvent *);
+
+ pthread_mutex_lock (&xlib_lock);
+ LOG("Error", "%p", handler);
+ ret = CALL(XSetErrorHandler, handler);
+ pthread_mutex_unlock (&xlib_lock);
+ return ret;
+ }
+ return CALL(XSetErrorHandler, handler);
+}
+
+int (*XSetIOErrorHandler (int (*handler) (Display *))) (Display *)
+{
+ if (override)
+ {
+ int (*ret) (Display *);
+
+ pthread_mutex_lock (&xlib_lock);
+ LOG("Error", "%p", handler);
+ ret = CALL(XSetIOErrorHandler, handler);
+ pthread_mutex_unlock (&xlib_lock);
+ return ret;
+ }
+ return CALL(XSetIOErrorHandler, handler);
+}
+#endif
#else
static void vlc_enable_override (void)
{
More information about the vlc-commits
mailing list