From c8874cc00b6b5e9dd97de0c204fb790161c5738e Mon Sep 17 00:00:00 2001 From: Strycher Date: Wed, 29 Jul 2026 23:26:22 -0400 Subject: [PATCH] fix(#406): guard mounted after danger-confirm dialog (Gemini review) _confirmDanger awaited showDialog then called _apply unconditionally; if the screen was disposed while the dialog was open, _apply's setState would throw. Guard with && mounted. Co-Authored-By: Claude Opus 4.8 --- lib/screens/settings/config_profile_preview_screen.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/screens/settings/config_profile_preview_screen.dart b/lib/screens/settings/config_profile_preview_screen.dart index 9c02807a..58e4ea3b 100644 --- a/lib/screens/settings/config_profile_preview_screen.dart +++ b/lib/screens/settings/config_profile_preview_screen.dart @@ -234,7 +234,9 @@ class _ConfigProfilePreviewScreenState ], ), ); - if (ok == true) await _apply(dangerWrites, 'Credential changes'); + // Guard the async gap: the screen may have been disposed while the dialog + // was open; _apply's setState would then throw (Gemini review). + if (ok == true && mounted) await _apply(dangerWrites, 'Credential changes'); } }