fixed some memory leaks in wemo plugin

This commit is contained in:
Simon Stürz 2014-08-15 19:11:11 +02:00 committed by Michael Zanetti
parent 202def72a7
commit 6cfd88a897
4 changed files with 17 additions and 12 deletions

View File

@ -61,6 +61,9 @@
VendorId elroVendorId = VendorId("435a13a0-65ca-4f0c-94c1-e5873b258db5");
VendorId mumbiVendorId = VendorId("5f91c01c-0168-4bdf-a5ed-37cb6971b775");
VendorId vivancoVendorId = VendorId("3826a836-ba69-4e50-8408-bb827fc92128");
VendorId brennenstuhlVendorId = VendorId("4ac9dd1f-9ca9-4a76-aae1-3e91cfb86f5b");
VendorId batVendorId = VendorId("30115ad4-c83d-454a-a483-c781c951d3b6");
DeviceClassId elroRemoteId = DeviceClassId("d85c1ef4-197c-4053-8e40-707aa671d302");
DeviceClassId elroSwitchId = DeviceClassId("308ae6e6-38b3-4b3a-a513-3199da2764f8");
@ -69,17 +72,17 @@ DeviceClassId elroMotionDetectorId = DeviceClassId("4c64aee6-7a4f-41f2-b278-edc5
DevicePluginElro::DevicePluginElro()
{
}
QList<Vendor> DevicePluginElro::supportedVendors() const
{
QList<Vendor> ret;
Vendor elro(elroVendorId, "Electronic Roos");
ret.append(elro);
Vendor mumbi(mumbiVendorId, "Mumbi");
ret.append(mumbi);
ret.append(Vendor(elroVendorId, "Elro"));
ret.append(Vendor(mumbiVendorId, "Mumbi"));
ret.append(Vendor(vivancoVendorId, "Vivanco"));
ret.append(Vendor(brennenstuhlVendorId, "Brennenstuhl"));
ret.append(Vendor(batVendorId, "BAT"));
return ret;
}

View File

@ -287,6 +287,7 @@ void DevicePluginWemo::deviceRemoved(Device *device)
WemoSwitch *wemoSwitch= m_wemoSwitches.key(device);
qDebug() << "remove wemo swich " << wemoSwitch->serialNumber();
wemoSwitch->deleteLater();
m_wemoSwitches.remove(wemoSwitch);
}

View File

@ -131,19 +131,20 @@ bool WemoSwitch::powerState()
return m_powerState;
}
bool WemoSwitch::reachabel()
bool WemoSwitch::reachable()
{
return m_reachabel;
return m_reachable;
}
void WemoSwitch::replyFinished(QNetworkReply *reply)
{
if(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200){
m_reachabel = false;
m_reachable = false;
emit stateChanged();
m_setPowerReplay->deleteLater();
return;
}else{
m_reachabel = true;
m_reachable = true;
}
// if this is the answerer to a refresh request

View File

@ -68,7 +68,7 @@ public:
QString uuid() const;
bool powerState();
bool reachabel();
bool reachable();
private:
QUrl m_location;
@ -87,7 +87,7 @@ private:
QNetworkReply *m_setPowerReplay;
bool m_powerState;
bool m_reachabel;
bool m_reachable;
ActionId m_actionId;
signals: