What changed, and why it matters
This small patch fixes two minor issues in a cryptocurrency wallet app. One change makes sure a settings toggle waits for its background task to finish before continuing, which could prevent a race condition or incomplete state. The other change makes the app correctly recognize when its Tor privacy feature is disabled, so it doesn't try to stop a service that was never running. These are defensive bug fixes rather than obvious security holes, but they touch privacy and notification settings.
Treat as a routine bug-fix commit. Reviewers may want to verify that setBackgroundSyncNotificationsEnabled properly propagates errors and that CakeTorDisabled is the only disabled state, but no immediate security response is indicated.
Security signals we found
Race condition mitigation: awaiting async setting update before error handling
Tor lifecycle guard: avoiding stop operations on disabled Tor implementation
No explicit security claims in commit message or diff
Evidence from the diff
The commit modifies two Dart files. In background_sync_page.dart, the onValueChange callback is made async and awaits dashboardViewModel.setBackgroundSyncNotificationsEnabled(value), ensuring the Future completes before any catch block handles errors. In tor.dart, ensureTorStopped now also returns early if CakeTor.instance is CakeTorDisabled, preventing attempts to stop Tor when it is disabled. The changes are minor and appear to be correctness/stability fixes.
Changed components
lib/src/screens/settings/background_sync_page.dartlib/utils/tor.dartInspect captured patch +4 / −3
diff --git a/lib/src/screens/settings/background_sync_page.dart b/lib/src/screens/settings/background_sync_page.dart
index 355b303a..5eac47a0 100644
--- a/lib/src/screens/settings/background_sync_page.dart
+++ b/lib/src/screens/settings/background_sync_page.dart
@@ -111,9 +111,9 @@ class BackgroundSyncPage extends BasePage {
return SettingsSwitcherCell(
title: S.current.new_transactions_notifications,
value: dashboardViewModel.backgroundSyncNotificationsEnabled,
- onValueChange: (_, bool value) {
+ onValueChange: (_, bool value) async {
try {
- dashboardViewModel.setBackgroundSyncNotificationsEnabled(value);
+ await dashboardViewModel.setBackgroundSyncNotificationsEnabled(value);
} catch (e) {
showPopUp(
context: context,
diff --git a/lib/utils/tor.dart b/lib/utils/tor.dart
index 877d216b..a691ff65 100644
--- a/lib/utils/tor.dart
+++ b/lib/utils/tor.dart
@@ -3,11 +3,12 @@ import 'dart:io';
import 'package:cw_core/utils/proxy_wrapper.dart';
import 'package:cw_core/utils/print_verbose.dart';
+import 'package:cw_core/utils/tor/disabled.dart';
import 'package:flutter/material.dart';
bool didTorStart = false;
Future<void> ensureTorStopped({required BuildContext? context}) async {
- if (!didTorStart) {
+ if (!didTorStart || CakeTor.instance is CakeTorDisabled) {
printV("Tor hasn't been initialized yet, so it can't be stopped.");
return;
}
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.