dix: disable all devices before shutdown
f3410b97cf
introduced a regression on server
shutdown. If any button or key was held on shutdown (ctrl, alt, backspace
are usually still down) sending a raw event will segfault the server. The
the root windows are set to NULL before calling CloseDownDevices().
Avoid this by disabling all devices first when shutting down. Disabled
devices won't send events anymore.
Master keyboards must be disabled first, otherwise disabling the pointer
will trigger DisableDevice(keyboard) and the keyboard is removed from the
inputInfo.devices list and moved to inputInfo.off_devices. A regular loop
through inputInfo.devices would thus jump to off_devices and not recover.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
parent
9c0e820216
commit
4c68f5d395
|
@ -501,6 +501,26 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DisableAllDevices(void)
|
||||||
|
{
|
||||||
|
DeviceIntPtr dev, tmp;
|
||||||
|
|
||||||
|
nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
|
||||||
|
if (!IsMaster(dev))
|
||||||
|
DisableDevice(dev, FALSE);
|
||||||
|
}
|
||||||
|
/* master keyboards need to be disabled first */
|
||||||
|
nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
|
||||||
|
if (dev->enabled && IsMaster(dev) && IsKeyboardDevice(dev))
|
||||||
|
DisableDevice(dev, FALSE);
|
||||||
|
}
|
||||||
|
nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
|
||||||
|
if (dev->enabled)
|
||||||
|
DisableDevice(dev, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise a new device through the driver and tell all clients about the
|
* Initialise a new device through the driver and tell all clients about the
|
||||||
* new device.
|
* new device.
|
||||||
|
|
|
@ -104,6 +104,7 @@ Equipment Corporation.
|
||||||
#include "privates.h"
|
#include "privates.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "exevents.h"
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
#include "panoramiXsrv.h"
|
#include "panoramiXsrv.h"
|
||||||
#else
|
#else
|
||||||
|
@ -295,6 +296,7 @@ main(int argc, char *argv[], char *envp[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UndisplayDevices();
|
UndisplayDevices();
|
||||||
|
DisableAllDevices();
|
||||||
|
|
||||||
/* Now free up whatever must be freed */
|
/* Now free up whatever must be freed */
|
||||||
if (screenIsSaved == SCREEN_SAVER_ON)
|
if (screenIsSaved == SCREEN_SAVER_ON)
|
||||||
|
@ -318,7 +320,9 @@ main(int argc, char *argv[], char *envp[])
|
||||||
|
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++)
|
||||||
screenInfo.screens[i]->root = NullWindow;
|
screenInfo.screens[i]->root = NullWindow;
|
||||||
|
|
||||||
CloseDownDevices();
|
CloseDownDevices();
|
||||||
|
|
||||||
CloseDownEvents();
|
CloseDownEvents();
|
||||||
|
|
||||||
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
|
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
|
||||||
|
|
|
@ -264,7 +264,7 @@ extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device */ ,
|
||||||
|
|
||||||
extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ ,
|
extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ ,
|
||||||
BOOL /* sendevent */ );
|
BOOL /* sendevent */ );
|
||||||
|
extern void DisableAllDevices(void);
|
||||||
extern int InitAndStartDevices(void);
|
extern int InitAndStartDevices(void);
|
||||||
|
|
||||||
extern void CloseDownDevices(void);
|
extern void CloseDownDevices(void);
|
||||||
|
|
Loading…
Reference in New Issue