mirror of https://github.com/nymea/nymea.git
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
parent
5674ba7567
commit
7633cfe9fa
|
|
@ -46,7 +46,9 @@ BrowserActionInfo::BrowserActionInfo(Thing *thing, ThingManager *thingManager, c
|
|||
if (timeout > 0) {
|
||||
QTimer::singleShot(timeout, this, [this] {
|
||||
emit aborted();
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
if (!m_finished) {
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ BrowseResult::BrowseResult(Thing *thing, ThingManager *thingManager, const QStri
|
|||
if (timeout > 0) {
|
||||
QTimer::singleShot(timeout, this, [this] {
|
||||
emit aborted();
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
if (!m_finished) {
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ BrowserItemActionInfo::BrowserItemActionInfo(Thing *thing, ThingManager *thingMa
|
|||
if (timeout > 0) {
|
||||
QTimer::singleShot(timeout, this, [this] {
|
||||
emit aborted();
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
if (!m_finished) {
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ BrowserItemResult::BrowserItemResult(Thing *thing, ThingManager *thingManager, c
|
|||
if (timeout > 0) {
|
||||
QTimer::singleShot(timeout, this, [this] {
|
||||
emit aborted();
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
if (!m_finished) {
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ ThingActionInfo::ThingActionInfo(Thing *thing, const Action &action, ThingManage
|
|||
if (timeout > 0) {
|
||||
QTimer::singleShot(timeout, this, [this] {
|
||||
emit aborted();
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
if (!m_finished) {
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ ThingDiscoveryInfo::ThingDiscoveryInfo(const ThingClassId &thingClassId, const P
|
|||
if (timeout > 0) {
|
||||
QTimer::singleShot(timeout, this, [this] {
|
||||
emit aborted();
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
if (!m_finished) {
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ ThingPairingInfo::ThingPairingInfo(const PairingTransactionId &pairingTransactio
|
|||
if (timeout > 0) {
|
||||
QTimer::singleShot(timeout, this, [this] {
|
||||
emit aborted();
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
if (!m_finished) {
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ ThingSetupInfo::ThingSetupInfo(Thing *thing, ThingManager *thingManager, quint32
|
|||
if (timeout > 0) {
|
||||
QTimer::singleShot(timeout, this, [this] {
|
||||
emit aborted();
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
if (!m_finished) {
|
||||
finish(Thing::ThingErrorTimeout);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue