From f4aa2b22ce338048199e42ba026ff68f09ed59fd Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 17 Feb 2024 00:04:19 +0100 Subject: [PATCH] Avoid starting Syncthing unintentionally when connection not metered anymore --- syncthingwidgets/misc/syncthinglauncher.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/syncthingwidgets/misc/syncthinglauncher.cpp b/syncthingwidgets/misc/syncthinglauncher.cpp index 7970a2a..7456bb3 100644 --- a/syncthingwidgets/misc/syncthinglauncher.cpp +++ b/syncthingwidgets/misc/syncthinglauncher.cpp @@ -342,6 +342,12 @@ void SyncthingLauncher::handleGuiListeningUrlFound(CppUtilities::BufferSearch &, void SyncthingLauncher::terminateDueToMeteredConnection() { + if (!isRunning()) { + // do not set m_stoppedMetered (and basically don't do anything) if not running anyway; otherwise we'd + // always start Syncthing once the connection is not metered anymore (even if Syncthing has not even been + // running before) + return; + } if (m_lastLauncherSettings && !m_relevantConnection) { m_relevantConnection = m_lastLauncherSettings->connectionForLauncher(this); }