summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-11-16 11:20:22 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-11-16 11:20:22 +1030
commit497862df2fcd67531fbe0f876c20a09884ee74df (patch)
tree92f8bcb83677a76b6cc7e60c8ebccbc3434982bb
parent9de1ebe2a80164507cbe2ef688f284225e0ec808 (diff)
dix: explicitly float all attached SDs before closing down devices.
Some drivers flush on shutdown, if our SD is still attached we'd be trying to route an event through a non-existing device.
-rw-r--r--dix/devices.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 045f74f0c..bc3313c6f 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -859,6 +859,17 @@ CloseDownDevices(void)
{
DeviceIntPtr dev, next;
+ /* 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
+ * AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
+ * to NULL and pretend nothing happened.
+ */
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (!dev->isMaster && dev->u.master)
+ dev->u.master = NULL;
+ }
+
for (dev = inputInfo.devices; dev; dev = next)
{
next = dev->next;