summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-06-07 10:42:50 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-06-07 15:17:55 +1000
commit0d140567ba2b5bf364265dba07de519f691c67a1 (patch)
treea3e00127df80438c321f5bb630802e4f690a277e /dix
parentbfd8422e8877acf02155ca0bd7fbd2416b029720 (diff)
dix: fix crashers with floating device.
dc57f89959e549403f8488eb9f23425bd7118b22 accidentally reversed the conditions. in dix/events.c we try to detach floating devices. This leads to a NULL-dereference on GetMaster()->id. in dix/getevents.c we try to get the master device for the floating slave and dereference it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'dix')
-rw-r--r--dix/events.c2
-rw-r--r--dix/getevents.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/dix/events.c b/dix/events.c
index 3fae52df0..3c7bd50cd 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1421,7 +1421,7 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
static void
DetachFromMaster(DeviceIntPtr dev)
{
- if (!IsFloating(dev))
+ if (IsFloating(dev))
return;
dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id;
diff --git a/dix/getevents.c b/dix/getevents.c
index 1352a81e5..c935c971c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -864,7 +864,7 @@ positionSprite(DeviceIntPtr dev, int mode,
* to the current screen. */
miPointerSetPosition(dev, mode, screenx, screeny);
- if(!IsMaster(dev) || !IsFloating(dev)) {
+ if(!IsMaster(dev) && !IsFloating(dev)) {
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
master->last.valuators[0] = *screenx;
master->last.valuators[1] = *screeny;
@@ -911,7 +911,7 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
return;
updateMotionHistory(dev, ms, mask, dev->last.valuators);
- if(!IsMaster(dev) || !IsFloating(dev))
+ if(!IsMaster(dev) && !IsFloating(dev))
{
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
updateMotionHistory(master, ms, mask, dev->last.valuators);