From 133a80acef80943f1b4cc4e3ae5081d55b2645a8 Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Mon, 22 Jan 2024 12:30:29 -0300 Subject: [PATCH] PM-3350 Fixed CancellationTokenSource proper disposal --- src/Core/Pages/Accounts/LoginPasswordlessViewModel.cs | 1 + src/Core/Utilities/TimerTask.cs | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Core/Pages/Accounts/LoginPasswordlessViewModel.cs b/src/Core/Pages/Accounts/LoginPasswordlessViewModel.cs index a5809659c..95033c7e1 100644 --- a/src/Core/Pages/Accounts/LoginPasswordlessViewModel.cs +++ b/src/Core/Pages/Accounts/LoginPasswordlessViewModel.cs @@ -77,6 +77,7 @@ namespace Bit.App.Pages { _requestTimeCts?.Cancel(); _requestTimeCts?.Dispose(); + _requestTimeCts = null; } catch (Exception ex) { diff --git a/src/Core/Utilities/TimerTask.cs b/src/Core/Utilities/TimerTask.cs index 27e0b81af..f2ac98778 100644 --- a/src/Core/Utilities/TimerTask.cs +++ b/src/Core/Utilities/TimerTask.cs @@ -1,9 +1,4 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Bit.Core.Abstractions; -using Microsoft.Maui.Controls; -using Microsoft.Maui; +using Bit.Core.Abstractions; namespace Bit.App.Utilities { @@ -37,7 +32,7 @@ namespace Bit.App.Utilities { while (!_cancellationTokenSource.IsCancellationRequested) { - await Device.InvokeOnMainThreadAsync(async () => + await MainThread.InvokeOnMainThreadAsync(async () => { if (!_cancellationTokenSource.IsCancellationRequested) {