summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <hramrach@gmail.com>2012-02-29 14:43:16 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2012-04-17 09:55:07 +1000
commit240cd0675b019f90bec481a17f3bf8ea99efe972 (patch)
tree9e1d062a8b0f6df8741cdc0f96de081d27c216be
parentdb9620c022e992f12bbbf2e9de9a25b9f0b2226d (diff)
Avoid crash on button events on device without valuators.server-1.11-branch
Backport of 2416ee4a015068359807a10f433e8c54192c78a9. Signed-off-by: Michal Suchanek <hramrach@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/getevents.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 058fa8ac7..bd8fd220e 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -198,9 +198,11 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
{
int i;
+ if (!dev->valuator)
+ return;
/* Set the data to the previous value for unset absolute axes. The values
* may be used when sent as part of an XI 1.x valuator event. */
- for (i = 0; i < valuator_mask_size(mask); i++)
+ for (i = 0; (i < valuator_mask_size(mask)) && (i < dev->valuator->numAxes); i++)
{
if (valuator_mask_isset(mask, i))
{
@@ -640,7 +642,7 @@ clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
{
AxisInfoPtr axis;
- if (axisNum >= pDev->valuator->numAxes)
+ if (!pDev->valuator || axisNum >= pDev->valuator->numAxes)
return;
axis = pDev->valuator->axes + axisNum;
@@ -1185,7 +1187,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
if (flags & POINTER_ABSOLUTE)
{
- if (flags & POINTER_SCREEN) /* valuators are in screen coords */
+ if ((flags & POINTER_SCREEN) && /* valuators are in screen coords */
+ pDev->valuator && (pDev->valuator->numAxes >= 2))
{
int scaled;