From 3cef63a4728e62d1c1575ea341fa1ca3977db367 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 16 Apr 2026 02:15:30 +0100 Subject: [PATCH] fix: DispatcherTimer leak in toast, delete-before-toast ordering in PostDraft --- EbayListingTool/Views/SavedListingsView.xaml.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/EbayListingTool/Views/SavedListingsView.xaml.cs b/EbayListingTool/Views/SavedListingsView.xaml.cs index 3f4a810..884826e 100644 --- a/EbayListingTool/Views/SavedListingsView.xaml.cs +++ b/EbayListingTool/Views/SavedListingsView.xaml.cs @@ -778,14 +778,14 @@ public partial class SavedListingsView : UserControl var draft = _selected.ToListingDraft(); var url = await _ebayListing.PostListingAsync(draft); - ToastUrlText.Text = url; - ShowDraftPostedToast(); - var posted = _selected; _selected = null; _service?.Delete(posted); ClearDetail(); RefreshList(); + + ToastUrlText.Text = url; + ShowDraftPostedToast(); } catch (Exception ex) { @@ -810,7 +810,11 @@ public partial class SavedListingsView : UserControl private void ShowDraftPostedToast() { - _toastTimer?.Stop(); + if (_toastTimer != null) + { + _toastTimer.Stop(); + _toastTimer = null; + } ToastTranslate.BeginAnimation(System.Windows.Media.TranslateTransform.YProperty, null); DraftPostedToast.Visibility = Visibility.Visible; @@ -835,6 +839,7 @@ public partial class SavedListingsView : UserControl private void DismissToastAnimated() { _toastTimer?.Stop(); + _toastTimer = null; var slideOut = new System.Windows.Media.Animation.DoubleAnimation( 0, 60, new Duration(TimeSpan.FromMilliseconds(180))) {