summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2009-07-25 20:17:25 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2009-07-25 20:17:25 -0700
commitb8e0f740829d0c81324aeb59222fc8e3d22493cc (patch)
tree03a8b5c20d2d80d6b981b56d60da87435658da32 /mi
parentdab8de036808e363a8ec9be826cff7fbcd92b953 (diff)
mieq: Protect from pDev=NULL in mieqEnqueue and mieqProcessInputEvents
(cherry picked from commit bf60ffb49700da367f7f88983b042a88fef7219b)
Diffstat (limited to 'mi')
-rw-r--r--mi/mieq.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mi/mieq.c b/mi/mieq.c
index f28a16d61..976fac9f2 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -217,7 +217,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
e->any.time = miEventQueue.lastEventTime;
miEventQueue.lastEventTime = ((InternalEvent*)evt->event)->any.time;
- miEventQueue.events[oldtail].pScreen = EnqueueScreen(pDev);
+ miEventQueue.events[oldtail].pScreen = pDev ? EnqueueScreen(pDev) : NULL;
miEventQueue.events[oldtail].pDev = pDev;
miEventQueue.lastMotion = isMotion;
@@ -383,7 +383,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
/* Custom event handler */
handler = miEventQueue.handlers[event->any.type];
- if (screen && screen != DequeueScreen(dev) && !handler) {
+ if (dev && screen && screen != DequeueScreen(dev) && !handler) {
/* Assumption - screen switching can only occur on motion events. */
DequeueScreen(dev) = screen;
x = event->device.root_x;
@@ -400,12 +400,12 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
* steal it. */
if (handler)
{
- handler(DequeueScreen(dev)->myNum, event, dev);
+ int screenNum = dev && DequeueScreen(dev) ? DequeueScreen(dev)->myNum : (screen ? screen->myNum : 0);
+ handler(screenNum, event, dev);
/* Check for the SD's master in case the device got detached
* during event processing */
if (master && dev->u.master)
- handler(DequeueScreen(master)->myNum,
- (InternalEvent*)masterEvents->event, master);
+ handler(screenNum, (InternalEvent*)masterEvents->event, master);
} else
{
/* process slave first, then master */
@@ -459,7 +459,7 @@ mieqProcessInputEvents(void)
pthread_mutex_unlock(&miEventQueueMutex);
#endif
- master = (!IsMaster(dev) && dev->u.master) ? dev->u.master : NULL;
+ master = (dev && !IsMaster(dev) && dev->u.master) ? dev->u.master : NULL;
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);