PM-3350 Fixed CancellationTokenSource proper disposal

This commit is contained in:
Federico Maccaroni 2024-01-22 12:30:29 -03:00
parent b43790de9a
commit 133a80acef
No known key found for this signature in database
GPG key ID: 5D233F8F2B034536
2 changed files with 3 additions and 7 deletions

View file

@ -77,6 +77,7 @@ namespace Bit.App.Pages
{ {
_requestTimeCts?.Cancel(); _requestTimeCts?.Cancel();
_requestTimeCts?.Dispose(); _requestTimeCts?.Dispose();
_requestTimeCts = null;
} }
catch (Exception ex) catch (Exception ex)
{ {

View file

@ -1,9 +1,4 @@
using System; using Bit.Core.Abstractions;
using System.Threading;
using System.Threading.Tasks;
using Bit.Core.Abstractions;
using Microsoft.Maui.Controls;
using Microsoft.Maui;
namespace Bit.App.Utilities namespace Bit.App.Utilities
{ {
@ -37,7 +32,7 @@ namespace Bit.App.Utilities
{ {
while (!_cancellationTokenSource.IsCancellationRequested) while (!_cancellationTokenSource.IsCancellationRequested)
{ {
await Device.InvokeOnMainThreadAsync(async () => await MainThread.InvokeOnMainThreadAsync(async () =>
{ {
if (!_cancellationTokenSource.IsCancellationRequested) if (!_cancellationTokenSource.IsCancellationRequested)
{ {