Handle reconfigure duplicated reference holding for goe charger

This commit is contained in:
Simon Stürz 2022-07-28 14:20:33 +02:00
parent 2716e54451
commit b9221ee746

View File

@ -112,6 +112,10 @@ void IntegrationPluginGoECharger::setupThing(ThingSetupInfo *info)
return; return;
} }
// Handle reconfigure
if (m_monitors.contains(thing))
hardwareManager()->networkDeviceDiscovery()->unregisterMonitor(m_monitors.take(thing));
// Create the monitor // Create the monitor
NetworkDeviceMonitor *monitor = hardwareManager()->networkDeviceDiscovery()->registerMonitor(macAddress); NetworkDeviceMonitor *monitor = hardwareManager()->networkDeviceDiscovery()->registerMonitor(macAddress);
m_monitors.insert(thing, monitor); m_monitors.insert(thing, monitor);