Fixing the leak in calendar mmode.

This commit is contained in:
Burak Kaan Köse
2026-04-09 01:26:23 +02:00
parent aaf0b7d069
commit a8310f1dab
4 changed files with 16 additions and 0 deletions
@@ -11,6 +11,7 @@
xmlns:viewModels="using:Wino.Calendar.ViewModels.Data"
x:Name="Root"
SizeChanged="ControlSizeChanged"
Unloaded="ControlUnloaded"
mc:Ignorable="d">
<UserControl.Resources>
@@ -324,6 +324,13 @@ public sealed partial class CalendarPeriodControl : UserControl, INotifyProperty
});
}
private void ControlUnloaded(object sender, RoutedEventArgs e)
{
DetachCurrentItemsSource();
_sizeRefreshTimer.Stop();
_sizeRefreshTimer.Tick -= SizeRefreshTimerTick;
}
private void SizeRefreshTimerTick(DispatcherQueueTimer sender, object args)
{
sender.Stop();
@@ -52,6 +52,12 @@ public sealed partial class CalendarPage : CalendarPageAbstract, ITitleBarSearch
base.OnNavigatingFrom(e);
}
public override void PrepareForClose()
{
DetachNavigationLifetimeEvents();
base.PrepareForClose();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
@@ -168,6 +168,8 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
{
ViewModel.StatePersistenceService.IsEventDetailsVisible = false;
ViewModel.CalendarClient.Deactivate();
WindowCleanupHelper.CleanupFrame(InnerShellFrame);
GC.Collect();
}
else if (_activeMode == WinoApplicationMode.Contacts)
{