From 497862df2fcd67531fbe0f876c20a09884ee74df Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 16 Nov 2007 11:20:22 +1030 Subject: [PATCH] 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. --- dix/devices.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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;