Fix mqtt items asserting on client instances
This commit is contained in:
parent
b0792d32db
commit
d69bfb58b9
4 changed files with 13 additions and 7 deletions
|
|
@ -26,6 +26,7 @@ void ItemLoaderSource::refresh()
|
|||
request.type = ITEM_UPDATE_LOADED;
|
||||
request.payload = newItem;
|
||||
request.changes = ItemFieldChanges(true);
|
||||
request.changes.value = false;
|
||||
itemAddRequests.push_back(request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <QtMqtt/QMqttClient>
|
||||
|
||||
#include "mqttclient.h"
|
||||
#include "programmode.h"
|
||||
|
||||
MqttItem::MqttItem(QString name, uint8_t value, QObject *parent)
|
||||
: Item(0, name, value, parent),
|
||||
|
|
@ -15,9 +16,10 @@ MqttItem::MqttItem(QString name, uint8_t value, QObject *parent)
|
|||
{
|
||||
hashId();
|
||||
std::shared_ptr<MqttClient> workClient = client.lock();
|
||||
assert(workClient);
|
||||
assert(workClient || programMode == PROGRAM_MODE_UI_ONLY);
|
||||
|
||||
connect(workClient->getClient().get(), &QMqttClient::stateChanged, this, &MqttItem::onClientStateChanged);
|
||||
if(workClient)
|
||||
connect(workClient->getClient().get(), &QMqttClient::stateChanged, this, &MqttItem::onClientStateChanged);
|
||||
}
|
||||
|
||||
MqttItem::~MqttItem()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue