Split the signal-handler's lastSlave out into a separate variable.
dev->u.lastSlave was not signal safe since it was accessed by the DIX and during signal handling. Replaced with: 'dev->last.slave' for the signal handler's lastSlave (used to generate DeviceChangedEvents), . 'dev->u.lastSlave' for the DIX lastSlave (currently only used in change_modmap) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
73c7398aaf
commit
add2defac7
|
@ -1010,7 +1010,6 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
|
|||
if (device->isMaster || !device->u.master)
|
||||
CheckMotion(event, device);
|
||||
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case ET_Motion:
|
||||
|
|
|
@ -433,6 +433,18 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
|
||||
(void)(*dev->deviceProc)(dev, DEVICE_OFF);
|
||||
dev->enabled = FALSE;
|
||||
|
||||
/* now that the device is disabled, we can reset the signal handler's
|
||||
* last.slave */
|
||||
OsBlockSignals();
|
||||
for (other = inputInfo.devices; other; other = other->next)
|
||||
{
|
||||
if (other->last.slave == dev)
|
||||
other->last.slave = NULL;
|
||||
}
|
||||
OsReleaseSignals();
|
||||
|
||||
|
||||
*prev = dev->next;
|
||||
dev->next = inputInfo.off_devices;
|
||||
inputInfo.off_devices = dev;
|
||||
|
@ -2367,6 +2379,7 @@ AllocDevicePair (ClientPtr client, char* name,
|
|||
pointer->spriteInfo->spriteOwner = TRUE;
|
||||
|
||||
pointer->u.lastSlave = NULL;
|
||||
pointer->last.slave = NULL;
|
||||
pointer->isMaster = master;
|
||||
|
||||
keyboard = AddInputDevice(client, CoreKeyboardProc, TRUE);
|
||||
|
@ -2389,6 +2402,7 @@ AllocDevicePair (ClientPtr client, char* name,
|
|||
keyboard->spriteInfo->spriteOwner = FALSE;
|
||||
|
||||
keyboard->u.lastSlave = NULL;
|
||||
keyboard->last.slave = NULL;
|
||||
keyboard->isMaster = master;
|
||||
|
||||
|
||||
|
|
|
@ -199,10 +199,10 @@ CreateClassesChangedEvent(EventList* event,
|
|||
dce->length = sizeof(DeviceChangedEvent);
|
||||
dce->type = ET_DeviceChanged;
|
||||
dce->time = ms;
|
||||
if (master->u.lastSlave)
|
||||
if (master->last.slave)
|
||||
{
|
||||
dce->flags |= DEVCHANGE_HAS_OLD_SLAVE;
|
||||
dce->old_slaveid = master->u.lastSlave->id;
|
||||
dce->old_slaveid = master->last.slave->id;
|
||||
}
|
||||
dce->flags |= DEVCHANGE_HAS_NEW_SLAVE;
|
||||
dce->new_slaveid = slave->id;
|
||||
|
@ -294,7 +294,7 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
|
|||
* slave-device. If the old slave had less axes than this one,
|
||||
* last.valuators is reset to 0.
|
||||
*/
|
||||
if ((lastSlave = master->u.lastSlave) && lastSlave->valuator) {
|
||||
if ((lastSlave = master->last.slave) && lastSlave->valuator) {
|
||||
for (i = 2; i < pDev->valuator->numAxes; i++) {
|
||||
if (i >= lastSlave->valuator->numAxes)
|
||||
pDev->last.valuators[i] = 0;
|
||||
|
@ -612,11 +612,11 @@ static EventListPtr
|
|||
updateFromMaster(EventListPtr events, DeviceIntPtr dev, int *num_events)
|
||||
{
|
||||
DeviceIntPtr master = dev->u.master;
|
||||
if (master && master->u.lastSlave != dev)
|
||||
if (master && master->last.slave != dev)
|
||||
{
|
||||
CreateClassesChangedEvent(events, master, dev);
|
||||
updateSlaveDeviceCoords(master, dev);
|
||||
master->u.lastSlave = dev;
|
||||
master->last.slave = dev;
|
||||
master->last.numValuators = dev->last.numValuators;
|
||||
(*num_events)++;
|
||||
events++;
|
||||
|
|
|
@ -507,6 +507,7 @@ typedef struct _DeviceIntRec {
|
|||
int valuators[MAX_VALUATORS];
|
||||
float remainder[MAX_VALUATORS];
|
||||
int numValuators;
|
||||
DeviceIntPtr slave;
|
||||
} last;
|
||||
|
||||
/* Input device property handling. */
|
||||
|
|
|
@ -370,8 +370,11 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
|
|||
{
|
||||
handler(DequeueScreen(dev)->myNum, event, dev);
|
||||
if (master)
|
||||
{
|
||||
master->u.lastSlave = dev;
|
||||
handler(DequeueScreen(master)->myNum,
|
||||
(InternalEvent*)masterEvents->event, master);
|
||||
}
|
||||
} else
|
||||
{
|
||||
/* process slave first, then master */
|
||||
|
|
Loading…
Reference in New Issue
Block a user