- trap X error reply to limit the damage of bug 183569.

This commit is contained in:
Ray Strode 2006-03-09 20:41:18 +00:00
parent 518ad438f4
commit f83aeaa6f0
2 changed files with 45 additions and 3 deletions

View File

@ -0,0 +1,42 @@
--- libxklavier-2.1.0.2006.02.23/libxklavier/xklavier_config_xkb.c.trap-x-error 2006-03-09 15:10:56.000000000 -0500
+++ libxklavier-2.1.0.2006.02.23/libxklavier/xklavier_config_xkb.c 2006-03-09 15:35:13.000000000 -0500
@@ -158,6 +158,20 @@ void _XklXkbConfigCleanupNative( XkbComp
free(componentNamesPtr->symbols);
free(componentNamesPtr->geometry);
}
+static int (* _XklTrapBeforeXkbWriteToServer) (Display *, XErrorEvent *);
+
+static int _XklXkbWriteToServerTrap (Display *dpy,
+ XErrorEvent *error_event)
+{
+ if (error_event->error_code != 0 &&
+ error_event->error_code != BadValue &&
+ _XklTrapBeforeXkbWriteToServer != NULL)
+ {
+ return _XklTrapBeforeXkbWriteToServer (dpy, error_event);
+ }
+
+ return 0;
+}
static XkbDescPtr _XklConfigGetKeyboard( XkbComponentNamesPtr componentNamesPtr, Bool activate )
{
@@ -243,8 +257,17 @@ static XkbDescPtr _XklConfigGetKeyboard(
XklDebug( 150, "Loaded legal keymap\n" );
if( activate )
{
+ Bool config_was_written = False;
+
XklDebug( 150, "Activating it...\n" );
- if( XkbWriteToServer(&result) )
+
+ _XklTrapBeforeXkbWriteToServer = XSetErrorHandler (_XklXkbWriteToServerTrap);
+
+ config_was_written = XkbWriteToServer (&result);
+
+ XSetErrorHandler (_XklTrapBeforeXkbWriteToServer);
+
+ if (config_was_written)
{
XklDebug( 150, "Updating the keyboard...\n" );
xkb = result.xkb;

View File

@ -1,7 +1,7 @@
Summary: library providing high-level API for X Keyboard Extension
Name: libxklavier
Version: 2.1.0.2006.02.23
Release: 1
Release: 2
License: LGPL
Group: Development/Libraries
Url: http://gswitchit.sourceforge.net/
@ -69,10 +69,10 @@ rm -rf %{buildroot}
%{_includedir}/*
%changelog
* Thu Mar 9 2006 Ray Strode <rstrode@redhat.com> - 2.1-5
* Thu Mar 9 2006 Ray Strode <rstrode@redhat.com> - 2.1.0.2006.02.23-2
- trap X error reply to limit the damage of bug 183569.
* Thu Feb 23 2006 Ray Strode <rstrode@redhat.com> - 2.1-4
* Thu Feb 23 2006 Ray Strode <rstrode@redhat.com> - 2.1.0.2006.02.23-1
- upgrade to latest cvs to handle xml comments (bug 178163)
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 2.1-3.2