From 0b4c6f095efd9c377a70dde8764e21ce3f06b45d Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Wed, 19 Aug 2026 11:06:44 +0800 Subject: [PATCH] Harden settings side effects Signed-off-by: Loren Eteval --- Furious/Controllers/SettingsController.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Furious/Controllers/SettingsController.py b/Furious/Controllers/SettingsController.py index 1a963a13..14d1339d 100644 --- a/Furious/Controllers/SettingsController.py +++ b/Furious/Controllers/SettingsController.py @@ -217,15 +217,20 @@ class SettingsController: cls._setBinary('HideDockIcon', enabled) @classmethod - def setStartupOnBoot(cls, enabled: bool): - """Apply the platform startup registration preference.""" + def setStartupOnBoot(cls, enabled: bool) -> bool: + """Persist startup preference only after host registration succeeds.""" if enabled: - StartupOnBoot.on_() + success = StartupOnBoot.on_() else: - StartupOnBoot.off() + success = StartupOnBoot.off() + + if not success: + return False cls._setBinary('StartupOnBoot', enabled) + return True + @classmethod def setPowerSaveMode(cls, enabled: bool): """Persist power-saving behavior for the next connection.""" @@ -290,7 +295,7 @@ class SettingsController: cls._setBinary(METRICS_COLLECTION_SETTING, enabled) try: - AppMainWindow().trafficStatsManager.setCollectionEnabled(enabled) + AppTrafficStatsManager().setCollectionEnabled(enabled) except (AttributeError, RuntimeError): pass