diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-04-16 16:35:22 +1000 |
---|---|---|
committer | Julien Cristau <jcristau@debian.org> | 2010-05-18 19:38:17 +0200 |
commit | d2f29b85d14fa56f22302854b585d04124b0db92 (patch) | |
tree | 0ef417c129aa8eab1fd270b189e9afacf74ee139 | |
parent | 89a2b2771f799f371c25945df18440dc4695909a (diff) |
xfree86: dga needs to use the master keyboard state (#27573)
GetPairedDevice() may not always return the keyboard, resulting in a
null-pointer dereference when accessing the XKB state.
For floating devices, the GetMaster() returns the device itself.
X.Org Bug 27573 <http://bugs.freedesktop.org/show_bug.cgi?id=27573>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Tested-by: Ben Hutchings <ben@decadent.org.uk>
(cherry picked from commit 10de9e8ee37265a35ceeceb2007d711da70d4f2d)
-rw-r--r-- | hw/xfree86/common/xf86DGA.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 804fd37c1..5d8addbed 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -1088,13 +1088,15 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse) ButtonClassPtr butc = mouse->button; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); DeviceEvent ev; + DeviceIntPtr master = GetMaster(mouse, MASTER_KEYBOARD); memset(&ev, 0, sizeof(ev)); ev.header = ET_Internal; ev.length = sizeof(ev); ev.type = event->subtype; ev.corestate = butc->state; - ev.corestate |= XkbStateFieldFromRec(&GetPairedDevice(mouse)->key->xkbInfo->state); + if (master && master->key) + ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state); UpdateDeviceState(mouse, &ev); |