summaryrefslogtreecommitdiff
authorPeter Hutterer <peter.hutterer@who-t.net>2009-08-09 23:50:16 (GMT)
committer Peter Hutterer <peter.hutterer@who-t.net>2009-08-13 01:19:35 (GMT)
commite46f02fa2de79261221b42ab73f9daa2ce8ac650 (patch) (side-by-side diff)
tree9039ee5071bf61b632c1bd9fd7a046e172c856c9
parent8483b08152104dc619d9e44f877d2687d866355e (diff)
downloadxserver-e46f02fa2de79261221b42ab73f9daa2ce8ac650.zip
xserver-e46f02fa2de79261221b42ab73f9daa2ce8ac650.tar.gz
Xext: allocate a separate event list for XTest events (#23100)
XTest event processing may be interrupted by a SIGIO. If Xtest uses the same event list as the rest of the server, this list may be overwritten in-flight. X.Org Bug 23100 <http://bugs.freedesktop.org/show_bug.cgi?id=23100> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Xext/xtest.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 5eddffa..6248732 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -55,6 +55,11 @@
extern int DeviceValuator;
extern int DeviceMotionNotify;
+/* XTest events are sent during request processing and may be interruped by
+ * a SIGIO. We need a separate event list to avoid events overwriting each
+ * other's memory */
+static EventListPtr xtest_evlist;
+
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@@ -82,6 +87,8 @@ XTestExtensionInit(INITARGS)
AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
NULL, StandardMinorOpcode);
+
+ xtest_evlist = InitEventList(GetMaximumEventsNum());
}
static int
@@ -155,7 +162,6 @@ ProcXTestFakeInput(ClientPtr client)
int valuators[MAX_VALUATORS] = {0};
int numValuators = 0;
int firstValuator = 0;
- EventListPtr events;
int nevents = 0;
int i;
int base = 0;
@@ -407,26 +413,25 @@ ProcXTestFakeInput(ClientPtr client)
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
- GetEventList(&events);
switch(type) {
case MotionNotify:
- nevents = GetPointerEvents(events, dev, type, 0, flags,
+ nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags,
firstValuator, numValuators, valuators);
break;
case ButtonPress:
case ButtonRelease:
- nevents = GetPointerEvents(events, dev, type, ev->u.u.detail,
+ nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail,
flags, firstValuator,
numValuators, valuators);
break;
case KeyPress:
case KeyRelease:
- nevents = GetKeyboardEvents(events, dev, type, ev->u.u.detail);
+ nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail);
break;
}
for (i = 0; i < nevents; i++)
- mieqProcessDeviceEvent(dev, (InternalEvent*)(events+i)->event, NULL);
+ mieqProcessDeviceEvent(dev, (InternalEvent*)(xtest_evlist+i)->event, NULL);
miPointerUpdateSprite(dev);
return client->noClientException;