summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-09-12 20:18:06 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-09-12 20:20:41 -0700
commit622cf1834725c3348cfdc41c12e39b327011c836 (patch)
treead31f47507fea1cba8fd48c3687cc4097472636d
parentbc7933171e08215ba28bc06c80ee1bc1febc0522 (diff)
Fix crashes due to MouseBlockHandler/MouseWakeupHandler with invalid devices
Don't install the handlers if devices failed to open/initalize. Remove the handlers when disabling Emulate3Soft mode, since otherwise they'll be left around when device is closed & device structs are freed. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--src/mouse.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mouse.c b/src/mouse.c
index 23dc726..8347be9 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -1691,6 +1691,11 @@ MouseProc(DeviceIntPtr device, int what)
}
xf86FlushInput(pInfo->fd);
xf86AddEnabledDevice(pInfo);
+ if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) {
+ RegisterBlockAndWakeupHandlers (MouseBlockHandler,
+ MouseWakeupHandler,
+ (pointer) pInfo);
+ }
}
}
}
@@ -1701,11 +1706,6 @@ MouseProc(DeviceIntPtr device, int what)
pMse->wheelButtonExpires = GetTimeInMillis ();
device->public.on = TRUE;
FlushButtons(pMse);
- if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
- {
- RegisterBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler,
- (pointer) pInfo);
- }
break;
case DEVICE_OFF:
@@ -1720,7 +1720,8 @@ MouseProc(DeviceIntPtr device, int what)
pInfo->fd = -1;
if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
{
- RemoveBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler,
+ RemoveBlockAndWakeupHandlers (MouseBlockHandler,
+ MouseWakeupHandler,
(pointer) pInfo);
}
}
@@ -1967,7 +1968,10 @@ Emulate3ButtonsSoft(InputInfoPtr pInfo)
buttonTimer(pInfo);
xf86Msg(X_INFO,"3rd Button detected: disabling emulate3Button\n");
-
+
+ RemoveBlockAndWakeupHandlers (MouseBlockHandler, MouseWakeupHandler,
+ (pointer) pInfo);
+
return FALSE;
}