mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-09 07:18:05 +02:00
Fix hal shutdown crash.
Removing the device invalidates its ->next pointer. Copy it aside before
destroying the device.
(cherry picked from commit f52f6c5c7e)
This commit is contained in:
parent
458b487723
commit
d5a7badd6a
1 changed files with 5 additions and 3 deletions
|
|
@ -63,7 +63,7 @@ remove_device(DeviceIntPtr dev)
|
||||||
static void
|
static void
|
||||||
device_removed(LibHalContext *ctx, const char *udi)
|
device_removed(LibHalContext *ctx, const char *udi)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev, next;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */
|
value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */
|
||||||
|
|
@ -71,11 +71,13 @@ device_removed(LibHalContext *ctx, const char *udi)
|
||||||
return;
|
return;
|
||||||
sprintf(value, "hal:%s", udi);
|
sprintf(value, "hal:%s", udi);
|
||||||
|
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
for (dev = inputInfo.devices; dev; dev = next) {
|
||||||
|
next = dev->next;
|
||||||
if (dev->config_info && strcmp(dev->config_info, value) == 0)
|
if (dev->config_info && strcmp(dev->config_info, value) == 0)
|
||||||
remove_device(dev);
|
remove_device(dev);
|
||||||
}
|
}
|
||||||
for (dev = inputInfo.off_devices; dev; dev = dev->next) {
|
for (dev = inputInfo.off_devices; dev; dev = next) {
|
||||||
|
next = dev->next;
|
||||||
if (dev->config_info && strcmp(dev->config_info, value) == 0)
|
if (dev->config_info && strcmp(dev->config_info, value) == 0)
|
||||||
remove_device(dev);
|
remove_device(dev);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue