From 28957b4f6f63e04499c9b485b4162b60b09a6a8a Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Sun, 18 Jan 2026 05:28:03 +0200 Subject: [PATCH] Fix timer memory leaks in login and authentication screens --- app/lib/screens/authentication_screen.dart | 8 ++++++++ app/lib/screens/login_screen.dart | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/app/lib/screens/authentication_screen.dart b/app/lib/screens/authentication_screen.dart index dae188239..6453fe57e 100644 --- a/app/lib/screens/authentication_screen.dart +++ b/app/lib/screens/authentication_screen.dart @@ -56,6 +56,14 @@ class AuthenticationScreenState extends State { WidgetsBinding.instance.addPostFrameCallback((_) => checkFingerprint()); } + @override + void dispose() { + if (widget.loginData != null && widget.loginData!.isMobile == false) { + timer.cancel(); + } + super.dispose(); + } + timeoutTimer() async { if (!mounted) { timer.cancel(); diff --git a/app/lib/screens/login_screen.dart b/app/lib/screens/login_screen.dart index 9f76b133f..9860da74c 100644 --- a/app/lib/screens/login_screen.dart +++ b/app/lib/screens/login_screen.dart @@ -77,6 +77,14 @@ class _LoginScreenState extends State with BlockAndRunMixin { }); } + @override + void dispose() { + if (!isMobileCheck) { + timer.cancel(); + } + super.dispose(); + } + timeoutTimer() async { if (!mounted) { timer.cancel();