diff options
Diffstat (limited to 'gdk/x11/gdkmain-x11.c')
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 996715c75f..ca20f97304 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -62,7 +62,8 @@ struct _GdkPredicate }; /* non-GDK previous error handler */ -static int (*_gdk_old_error_handler) (Display *, XErrorEvent *); +typedef int (*GdkXErrorHandler) (Display *, XErrorEvent *); +static GdkXErrorHandler _gdk_old_error_handler; /* number of times we've pushed the GDK error handler */ static int _gdk_error_handler_push_count = 0; @@ -386,13 +387,19 @@ gdk_x_error (Display *xdisplay, void _gdk_x11_error_handler_push (void) { - _gdk_old_error_handler = XSetErrorHandler (gdk_x_error); + GdkXErrorHandler previous; + + previous = XSetErrorHandler (gdk_x_error); if (_gdk_error_handler_push_count > 0) { - if (_gdk_old_error_handler != gdk_x_error) + if (previous != gdk_x_error) g_warning ("XSetErrorHandler() called with a GDK error trap pushed. Don't do that."); } + else + { + _gdk_old_error_handler = previous; + } _gdk_error_handler_push_count += 1; } |