Track whether setup detection has already been started and avoid running it twice
This makes the code more explicit about avoiding triggering the setup detection twice. Maybe it fixes https://github.com/Martchus/syncthingtray/issues/174 but likely it does not change the behavior (in general).
This commit is contained in:
parent
3829b65f85
commit
cc2b3365fb
|
@ -98,10 +98,15 @@ void SetupDetection::reset()
|
|||
launcherExitStatus.reset();
|
||||
launcherError.reset();
|
||||
launcherOutput.clear();
|
||||
m_testStarted = false;
|
||||
}
|
||||
|
||||
void SetupDetection::startTest()
|
||||
{
|
||||
if (m_testStarted) {
|
||||
return;
|
||||
}
|
||||
m_testStarted = true;
|
||||
restoreConfig();
|
||||
initConnection();
|
||||
connection.reconnect();
|
||||
|
@ -141,8 +146,12 @@ void SetupDetection::handleTimeout()
|
|||
|
||||
void SetupDetection::checkDone()
|
||||
{
|
||||
if (!m_testStarted) {
|
||||
return;
|
||||
}
|
||||
if (isDone()) {
|
||||
timeout.stop();
|
||||
m_testStarted = false;
|
||||
emit done();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@ public:
|
|||
bool timedOut = false;
|
||||
bool configOk = false;
|
||||
bool autostartEnabled = false;
|
||||
|
||||
private:
|
||||
bool m_testStarted = false;
|
||||
};
|
||||
|
||||
} // namespace QtGui
|
||||
|
|
|
@ -532,7 +532,6 @@ void DetectionWizardPage::initializePage()
|
|||
}
|
||||
|
||||
m_setupDetection->reset();
|
||||
connect(m_setupDetection, &SetupDetection::done, this, &DetectionWizardPage::continueIfDone);
|
||||
emit completeChanged();
|
||||
QTimer::singleShot(0, this, &DetectionWizardPage::tryToConnect);
|
||||
}
|
||||
|
@ -591,6 +590,7 @@ void DetectionWizardPage::tryToConnect()
|
|||
}
|
||||
|
||||
// start setup detection tests
|
||||
connect(m_setupDetection, &SetupDetection::done, this, &DetectionWizardPage::continueIfDone, Qt::QueuedConnection);
|
||||
m_setupDetection->startTest();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue