summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2022-03-16 17:14:05 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2022-03-16 17:14:05 +0900
commit5f795c0bb25aea83d00be9f19468678178937630 (patch)
tree8b70b5cb1674b309a414cee0d8fa4f3e7463281a
parent452ca94c96f7b4ad2ea8a8b6ebe24f1373dc4004 (diff)
downloadtdelibs-5f795c0bb25aea83d00be9f19468678178937630.tar.gz
tdelibs-5f795c0bb25aea83d00be9f19468678178937630.zip
tdehw lib: make sure to emit hardwareRemoved signal after removing the device from the device list.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--tdecore/tdehw/tdehardwaredevices.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp
index 7ac5622ba..0da216a87 100644
--- a/tdecore/tdehw/tdehardwaredevices.cpp
+++ b/tdecore/tdehw/tdehardwaredevices.cpp
@@ -439,8 +439,11 @@ void TDEHardwareDevices::processHotPluggedHardware() {
}
rescanDeviceInformation(hwdevice, dev);
- emit hardwareRemoved(hwdevice);
- m_deviceList.remove(hwdevice);
+ if (m_deviceList.find(hwdevice) != -1 && m_deviceList.take())
+ {
+ emit hardwareRemoved(hwdevice);
+ delete hwdevice;
+ }
break;
}
}
@@ -887,7 +890,9 @@ void TDEHardwareDevices::processStatelessDevices() {
// We can't use m_deviceList directly as m_deviceList can only have one iterator active against it at any given time
TDEGenericHardwareList devList = listAllPhysicalDevices();
for ( hwdevice = devList.first(); hwdevice; hwdevice = devList.next() ) {
- if ((hwdevice->type() == TDEGenericDeviceType::RootSystem) || (hwdevice->type() == TDEGenericDeviceType::Network) || (hwdevice->type() == TDEGenericDeviceType::OtherSensor) || (hwdevice->type() == TDEGenericDeviceType::Event) || (hwdevice->type() == TDEGenericDeviceType::Battery) || (hwdevice->type() == TDEGenericDeviceType::PowerSupply)) {
+ if ((hwdevice->type() == TDEGenericDeviceType::RootSystem) || (hwdevice->type() == TDEGenericDeviceType::Network) ||
+ (hwdevice->type() == TDEGenericDeviceType::OtherSensor) || (hwdevice->type() == TDEGenericDeviceType::Event) ||
+ (hwdevice->type() == TDEGenericDeviceType::Battery) || (hwdevice->type() == TDEGenericDeviceType::PowerSupply)) {
rescanDeviceInformation(hwdevice, NULL, false);
emit hardwareUpdated(hwdevice);
#ifdef STATELESSPROFILING