Fix Crash when values that have been deleted (#17)

* Allow Statistics Timeout to be adjustable

* Fix Crash with Values that have been deleted/removed when the Notification Arrives at the app
This commit is contained in:
Justin Hammond 2020-01-17 16:16:08 +08:00 committed by GitHub
parent 47f4b61364
commit 72a55e5b38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -1147,6 +1147,18 @@ bool QTOZWManager_Internal::convertValueID(quint64 vidKey) {
void QTOZWManager_Internal::pvt_valueAdded(quint64 vidKey) void QTOZWManager_Internal::pvt_valueAdded(quint64 vidKey)
{ {
try {
OpenZWave::ValueID vid(this->homeId(), vidKey);
if (!this->m_manager->IsValueValid(vid)) {
qCWarning(notifications) << "ValueAdded Notification for Key " << vidKey << " Is Invalid. Key Probably Deleted";
return;
}
} catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
this->setErrorString(e.GetMsg().c_str());
emit this->error(QTOZWManagerErrorCodes::OZWException);
}
qCDebug(notifications) << "Notification pvt_valueAdded:" << vidKey; qCDebug(notifications) << "Notification pvt_valueAdded:" << vidKey;
if (!this->m_validValues.contains(vidKey)) if (!this->m_validValues.contains(vidKey))
this->m_validValues.push_back(vidKey); this->m_validValues.push_back(vidKey);

View file

@ -785,7 +785,7 @@ void mqttpublisher::started(quint32 homeID) {
QT2JS::SetString(this->m_ozwstatus, "Status", "started"); QT2JS::SetString(this->m_ozwstatus, "Status", "started");
QT2JS::SetUint(this->m_ozwstatus, "homeID", homeID); QT2JS::SetUint(this->m_ozwstatus, "homeID", homeID);
this->sendStatusUpdate(); this->sendStatusUpdate();
this->m_statsTimer.start(10000); this->m_statsTimer.start(settings->value("StatisticsUpdateInterval", 30000).toInt());
} }
void mqttpublisher::stopped(quint32 homeID) { void mqttpublisher::stopped(quint32 homeID) {
qCDebug(ozwmp) << "Publishing Event stopped"; qCDebug(ozwmp) << "Publishing Event stopped";

View file

@ -73,7 +73,7 @@ ldd $EXECUTABLE | awk '{print $3}' |
fi fi
done done
LIBS+=" /usr/local/lib/ozwdaemon" LIBS+=" /usr/local/bin/ozwdaemon"
echo $LIBS echo $LIBS
sentry-cli --auth-token $SENTRY_TOKEN upload-dif -o openzwave -p qt-openzwave $LIBS --wait sentry-cli --auth-token $SENTRY_TOKEN upload-dif -o openzwave -p qt-openzwave $LIBS --wait
} }