From 7effea87949d81f5b6f4db0ef5e2e29b55cbb846 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 16 Apr 2010 16:35:22 +1000 Subject: [PATCH] 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 Signed-off-by: Peter Hutterer Reviewed-by: Daniel Stone --- 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 804fd37..5d8addb 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); -- 1.6.6.1