diff options
author | marha <marha@users.sourceforge.net> | 2010-02-05 12:56:11 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-02-05 12:56:11 +0000 |
commit | 7fe172c9035f56977209da12a7fd67d8badd71a2 (patch) | |
tree | b8e23664e5fefebcb80cc0657674db1b8c46ceba /xorg-server/dix/devices.c | |
parent | 007385f704a99ab49dab0789f9c330a1a3a455be (diff) | |
download | vcxsrv-7fe172c9035f56977209da12a7fd67d8badd71a2.tar.gz vcxsrv-7fe172c9035f56977209da12a7fd67d8badd71a2.tar.bz2 vcxsrv-7fe172c9035f56977209da12a7fd67d8badd71a2.zip |
Git update 5/2/2010
Diffstat (limited to 'xorg-server/dix/devices.c')
-rw-r--r-- | xorg-server/dix/devices.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 92b95ed69..b002150d0 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -877,13 +877,43 @@ CloseDevice(DeviceIntPtr dev) } /** + * Shut down all devices of one list and free all resources. + */ +static +void +CloseDeviceList(DeviceIntPtr *listHead) +{ + /* Used to mark devices that we tried to free */ + Bool freedIds[MAXDEVICES]; + DeviceIntPtr dev; + int i; + + if (listHead == NULL) + return; + + for (i = 0; i < MAXDEVICES; i++) + freedIds[i] = FALSE; + + dev = *listHead; + while (dev != NULL) + { + freedIds[dev->id] = TRUE; + DeleteInputDeviceRequest(dev); + + dev = *listHead; + while (dev != NULL && freedIds[dev->id]) + dev = dev->next; + } +} + +/** * Shut down all devices, free all resources, etc. * Only useful if you're shutting down the server! */ void CloseDownDevices(void) { - DeviceIntPtr dev, next; + DeviceIntPtr dev; /* Float all SDs before closing them. Note that at this point resources * (e.g. cursors) have been freed already, so we can't just call @@ -896,16 +926,8 @@ CloseDownDevices(void) dev->u.master = NULL; } - for (dev = inputInfo.devices; dev; dev = next) - { - next = dev->next; - DeleteInputDeviceRequest(dev); - } - for (dev = inputInfo.off_devices; dev; dev = next) - { - next = dev->next; - DeleteInputDeviceRequest(dev); - } + CloseDeviceList(&inputInfo.devices); + CloseDeviceList(&inputInfo.off_devices); CloseDevice(inputInfo.pointer); CloseDevice(inputInfo.keyboard); |