harden SettingsStore against notify-after-dispose for fire-and-forget writes
set() doesn't await its file write, so a write in flight when the store is disposed (app shutdown, or a closing test) would assert on a disposed ChangeNotifier. Skip the post-write notify once disposed via a _disposed guard + _safeNotify. Surfaced by the T-293 theme-persistence test flaking under the loaded parallel run; also the correct behaviour for graceful shutdown. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,7 +39,7 @@ void main() {
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
await pumpEventQueue(); // flush any in-flight unawaited set() file writes
|
||||
await pumpEventQueue(); // let in-flight writes settle (dispose then no-ops any straggler)
|
||||
settings.dispose();
|
||||
theme.dispose();
|
||||
for (final d in [appTmp, repoTmp]) {
|
||||
|
||||
Reference in New Issue
Block a user