fixed memory leak on reconfigure

master
Boernsman 2020-12-09 13:27:51 +01:00
parent 465dcf9b29
commit 3d8c9bdd56
1 changed files with 8 additions and 1 deletions

View File

@ -112,9 +112,16 @@ void IntegrationPluginTado::setupThing(ThingSetupInfo *info)
if (thing->thingClassId() == tadoAccountThingClassId) {
qCDebug(dcTado) << "Setup tado connection" << thing->name() << thing->params();
qCDebug(dcTado) << "Setup Tado account" << thing->name() << thing->params();
Tado *tado;
if (m_tadoAccounts.contains(thing->id())) {
qCDebug(dcTado()) << "Setup after reconfigure, cleaning up";
m_tadoAccounts.take(thing->id())->deleteLater();
}
if (m_unfinishedTadoAccounts.contains(thing->id())) {
qCDebug(dcTado()) << "Using Tado connection from pairing process";
tado = m_unfinishedTadoAccounts.take(thing->id());
m_tadoAccounts.insert(thing->id(), tado);
info->finish(Thing::ThingErrorNoError);