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>
pull/158/head
Michele Calgaro 3 years ago
parent 452ca94c96
commit 5f795c0bb2
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -439,8 +439,11 @@ void TDEHardwareDevices::processHotPluggedHardware() {
} }
rescanDeviceInformation(hwdevice, dev); rescanDeviceInformation(hwdevice, dev);
emit hardwareRemoved(hwdevice); if (m_deviceList.find(hwdevice) != -1 && m_deviceList.take())
m_deviceList.remove(hwdevice); {
emit hardwareRemoved(hwdevice);
delete hwdevice;
}
break; 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 // 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(); TDEGenericHardwareList devList = listAllPhysicalDevices();
for ( hwdevice = devList.first(); hwdevice; hwdevice = devList.next() ) { 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); rescanDeviceInformation(hwdevice, NULL, false);
emit hardwareUpdated(hwdevice); emit hardwareUpdated(hwdevice);
#ifdef STATELESSPROFILING #ifdef STATELESSPROFILING

Loading…
Cancel
Save