NetworkDeviceDiscovery: Fix cache update reference bug

This commit is contained in:
Simon Stürz 2025-11-15 15:54:47 +01:00
parent 889a52959f
commit 415e1a7648

View File

@ -515,15 +515,12 @@ void NetworkDeviceDiscoveryImpl::processMonitorPingResult(PingReply *reply, Netw
<< "-->" << "-->"
<< reply->targetHostAddress().toString(); << reply->targetHostAddress().toString();
removeFromNetworkDeviceCache(oldAddress);
NetworkDeviceInfo info = m_networkInfoCache.at(i); NetworkDeviceInfo info = m_networkInfoCache.at(i);
removeFromNetworkDeviceCache(oldAddress);
info.setAddress(reply->targetHostAddress()); info.setAddress(reply->targetHostAddress());
monitor->setNetworkDeviceInfo(info); monitor->setNetworkDeviceInfo(info);
m_networkInfoCache[i] = info; updateCache(info);
m_networkInfoCache.sortNetworkDevices();
saveNetworkDeviceCache(info);
break; break;
} }
} }
@ -812,14 +809,11 @@ void NetworkDeviceDiscoveryImpl::processArpTraffic(const QNetworkInterface &inte
<< "-->" << "-->"
<< address.toString(); << address.toString();
removeFromNetworkDeviceCache(oldAddress);
NetworkDeviceInfo info = m_networkInfoCache.at(i); NetworkDeviceInfo info = m_networkInfoCache.at(i);
removeFromNetworkDeviceCache(oldAddress);
info.setAddress(address); info.setAddress(address);
m_networkInfoCache[i] = info; updateCache(info);
m_networkInfoCache.sortNetworkDevices();
saveNetworkDeviceCache(info);
foreach (NetworkDeviceMonitorImpl *monitor, m_monitors.keys()) { foreach (NetworkDeviceMonitorImpl *monitor, m_monitors.keys()) {
if (monitor->macAddress() == macAddress) { if (monitor->macAddress() == macAddress) {