From ded35b7bf7a5ad27de152476c657a56a4f232800 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 17 Sep 2009 18:14:33 -0700 Subject: [PATCH] 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 Signed-off-by: Peter Hutterer --- hw/xfree86/common/xf86Init.c | 2 ++ hw/xfree86/common/xf86Xinput.c | 9 --------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 1242de97d..c9baff3ef 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -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 */ diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 974b30e80..b36953700 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -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,