diff options
author | Michele Calgaro <[email protected]> | 2014-11-27 11:52:10 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2014-11-27 11:52:10 +0900 |
commit | 777f25f20f991357acf93582471900f6b85532a1 (patch) | |
tree | 041a26f32bcf2f53249660b4cabd42c8e7a1ded2 /tdecore/tdehw/tdehardwaredevices.cpp | |
parent | 01d88b2886ada398c883a44410827b11b907e512 (diff) | |
parent | 911c41c9f7a08b7fb3476954472f747365999daf (diff) | |
download | tdelibs-777f25f20f991357acf93582471900f6b85532a1.tar.gz tdelibs-777f25f20f991357acf93582471900f6b85532a1.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tdelibs
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; } } |