Check Info objects for finished abert aborting them

This gives plugin developers a chance to finish() an info on their
own in an aborted() handler and set a custom error code and
displayMessage without causing a "finishing an already finished object"
warning.
pull/552/head
Michael Zanetti 2022-08-04 18:34:21 +02:00
parent 5674ba7567
commit 7633cfe9fa
8 changed files with 24 additions and 8 deletions

View File

@ -46,7 +46,9 @@ BrowserActionInfo::BrowserActionInfo(Thing *thing, ThingManager *thingManager, c
if (timeout > 0) {
QTimer::singleShot(timeout, this, [this] {
emit aborted();
if (!m_finished) {
finish(Thing::ThingErrorTimeout);
}
});
}
}

View File

@ -47,7 +47,9 @@ BrowseResult::BrowseResult(Thing *thing, ThingManager *thingManager, const QStri
if (timeout > 0) {
QTimer::singleShot(timeout, this, [this] {
emit aborted();
if (!m_finished) {
finish(Thing::ThingErrorTimeout);
}
});
}
}

View File

@ -46,7 +46,9 @@ BrowserItemActionInfo::BrowserItemActionInfo(Thing *thing, ThingManager *thingMa
if (timeout > 0) {
QTimer::singleShot(timeout, this, [this] {
emit aborted();
if (!m_finished) {
finish(Thing::ThingErrorTimeout);
}
});
}
}

View File

@ -47,7 +47,9 @@ BrowserItemResult::BrowserItemResult(Thing *thing, ThingManager *thingManager, c
if (timeout > 0) {
QTimer::singleShot(timeout, this, [this] {
emit aborted();
if (!m_finished) {
finish(Thing::ThingErrorTimeout);
}
});
}
}

View File

@ -47,7 +47,9 @@ ThingActionInfo::ThingActionInfo(Thing *thing, const Action &action, ThingManage
if (timeout > 0) {
QTimer::singleShot(timeout, this, [this] {
emit aborted();
if (!m_finished) {
finish(Thing::ThingErrorTimeout);
}
});
}
}

View File

@ -46,7 +46,9 @@ ThingDiscoveryInfo::ThingDiscoveryInfo(const ThingClassId &thingClassId, const P
if (timeout > 0) {
QTimer::singleShot(timeout, this, [this] {
emit aborted();
if (!m_finished) {
finish(Thing::ThingErrorTimeout);
}
});
}
}

View File

@ -49,7 +49,9 @@ ThingPairingInfo::ThingPairingInfo(const PairingTransactionId &pairingTransactio
if (timeout > 0) {
QTimer::singleShot(timeout, this, [this] {
emit aborted();
if (!m_finished) {
finish(Thing::ThingErrorTimeout);
}
});
}
}

View File

@ -47,7 +47,9 @@ ThingSetupInfo::ThingSetupInfo(Thing *thing, ThingManager *thingManager, quint32
if (timeout > 0) {
QTimer::singleShot(timeout, this, [this] {
emit aborted();
if (!m_finished) {
finish(Thing::ThingErrorTimeout);
}
});
}
}