xf86Xinput.c: get DIX event queue pointer once at InitInput time

The DIX event queue is allocated before InitInput is called, so fetch
the pointer there and not randomly at other times. This avoids failing
to fetch the pointer sometimes during server regen and then smashing
memory through the stale pointer from the previous server generation.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Keith Packard 2009-09-17 18:14:33 -07:00 committed by Peter Hutterer
parent 54f15a4141
commit ded35b7bf7
2 changed files with 2 additions and 9 deletions

View File

@ -1112,6 +1112,8 @@ InitInput(int argc, char **argv)
mieqInit();
GetEventList(&xf86Events);
/* Call the PreInit function for each input device instance. */
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
/* Replace obsolete keyboard driver with kbd */

View File

@ -283,11 +283,6 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
/* Backwards compatibility. */
local->history_size = GetMotionHistorySize();
/* Preallocate xEvent store */
if (!xf86Events)
GetEventList(&xf86Events);
if (!xf86Events)
FatalError("Couldn't allocate event store\n");
}
/***********************************************************************
@ -769,7 +764,6 @@ xf86PostMotionEventP(DeviceIntPtr device,
}
#endif
GetEventList(&xf86Events);
nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0,
flags, first_valuator, num_valuators,
valuators);
@ -819,7 +813,6 @@ xf86PostProximityEventP(DeviceIntPtr device,
XI_VERIFY_VALUATORS(num_valuators);
GetEventList(&xf86Events);
nevents = GetProximityEvents(xf86Events, device,
is_in ? ProximityIn : ProximityOut,
first_valuator, num_valuators, valuators);
@ -881,7 +874,6 @@ xf86PostButtonEventP(DeviceIntPtr device,
}
#endif
GetEventList(&xf86Events);
nevents = GetPointerEvents(xf86Events, device,
is_down ? ButtonPress : ButtonRelease, button,
flags, first_valuator, num_valuators, valuators);
@ -940,7 +932,6 @@ xf86PostKeyEventP(DeviceIntPtr device,
XI_VERIFY_VALUATORS(num_valuators);
if (is_absolute) {
GetEventList(&xf86Events);
nevents = GetKeyboardValuatorEvents(xf86Events, device,
is_down ? KeyPress : KeyRelease,
key_code, first_valuator,