diff options
author | Timothy Pearson <[email protected]> | 2014-11-26 00:09:45 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2014-11-26 00:09:45 -0600 |
commit | 3b57fe6816f2a5837b3879e46b7286bf8d8c162c (patch) | |
tree | c716cceac9f4eed419e35bbbde37314707683b77 /tdecore/tdehw/tdehardwaredevices.cpp | |
parent | 9ea35022d237e93f456d8649725ce1c52c2b61e9 (diff) | |
download | tdelibs-3b57fe6816f2a5837b3879e46b7286bf8d8c162c.tar.gz tdelibs-3b57fe6816f2a5837b3879e46b7286bf8d8c162c.zip |
Fix hardware control center crashes on device hot remove
Fix incorrect decoding of hex escaped device names
Diffstat (limited to 'tdecore/tdehw/tdehardwaredevices.cpp')
-rw-r--r-- | tdecore/tdehw/tdehardwaredevices.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index 8905b6000..fd8ee3ba5 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -402,8 +402,8 @@ void TDEHardwareDevices::processHotPluggedHardware() { TDEGenericDevice *hwdevice; for (hwdevice = m_deviceList.first(); hwdevice; hwdevice = m_deviceList.next()) { if (hwdevice->systemPath() == systempath) { - emit hardwareRemoved(hwdevice); - emit hardwareEvent(TDEHardwareEvent::HardwareRemoved, hwdevice->uniqueID()); + // Temporarily disable auto-deletion to ensure object validity when calling the Removed events below + m_deviceList.setAutoDelete(false); // If the device is a storage device and has a slave, update it as well if (hwdevice->type() == TDEGenericDeviceType::Disk) { @@ -423,6 +423,13 @@ void TDEHardwareDevices::processHotPluggedHardware() { m_deviceList.remove(hwdevice); } + emit hardwareRemoved(hwdevice); + emit hardwareEvent(TDEHardwareEvent::HardwareRemoved, hwdevice->uniqueID()); + + // Reenable auto-deletion and delete the removed device object + m_deviceList.setAutoDelete(true); + delete hwdevice; + break; } } |