Stop libsyncthing when stopping the application
This commit is contained in:
parent
f9eba2d012
commit
972f7b2776
|
@ -128,9 +128,8 @@ void SyncthingLauncher::terminate()
|
|||
if (m_process.isRunning()) {
|
||||
m_manuallyStopped = true;
|
||||
m_process.stopSyncthing();
|
||||
} else if (m_future.isRunning()) {
|
||||
m_manuallyStopped = true;
|
||||
QtConcurrent::run(this, &SyncthingLauncher::stopLibSyncthing);
|
||||
} else {
|
||||
tearDownLibSyncthing();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,12 +138,22 @@ void SyncthingLauncher::kill()
|
|||
if (m_process.isRunning()) {
|
||||
m_manuallyStopped = true;
|
||||
m_process.killSyncthing();
|
||||
} else if (m_future.isRunning()) {
|
||||
m_manuallyStopped = true;
|
||||
QtConcurrent::run(this, &SyncthingLauncher::stopLibSyncthing);
|
||||
} else {
|
||||
tearDownLibSyncthing();
|
||||
}
|
||||
}
|
||||
|
||||
void SyncthingLauncher::tearDownLibSyncthing()
|
||||
{
|
||||
#ifdef SYNCTHINGWIDGETS_USE_LIBSYNCTHING
|
||||
if (!m_future.isRunning()) {
|
||||
return;
|
||||
}
|
||||
m_manuallyStopped = true;
|
||||
QtConcurrent::run(this, &SyncthingLauncher::stopLibSyncthing);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SyncthingLauncher::handleProcessReadyRead()
|
||||
{
|
||||
emit outputAvailable(m_process.readAll());
|
||||
|
|
|
@ -49,6 +49,7 @@ public Q_SLOTS:
|
|||
void launch(const LibSyncthing::RuntimeOptions &runtimeOptions);
|
||||
void terminate();
|
||||
void kill();
|
||||
void tearDownLibSyncthing();
|
||||
|
||||
private Q_SLOTS:
|
||||
void handleProcessReadyRead();
|
||||
|
|
|
@ -107,6 +107,10 @@ void Launcher::autostart() const
|
|||
*/
|
||||
void Launcher::terminate()
|
||||
{
|
||||
auto *const launcher = SyncthingLauncher::mainInstance();
|
||||
if (launcher) {
|
||||
launcher->tearDownLibSyncthing();
|
||||
}
|
||||
QtGui::SyncthingKiller(allProcesses()).waitForFinished();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue