From 8c7d355878f91848afc5ba595cfd568be6d5a860 Mon Sep 17 00:00:00 2001 From: unitycoder Date: Sun, 24 Nov 2024 18:43:05 +0200 Subject: [PATCH] cancel edit cell if exit unity, fixes #176 --- UnityLauncherPro/MainWindow.xaml.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/UnityLauncherPro/MainWindow.xaml.cs b/UnityLauncherPro/MainWindow.xaml.cs index 5489700..ce876f2 100644 --- a/UnityLauncherPro/MainWindow.xaml.cs +++ b/UnityLauncherPro/MainWindow.xaml.cs @@ -2931,6 +2931,13 @@ public void ProcessExitedCallBack(Project proj) //Console.WriteLine("Process Exited: " + proj.Path); //var index = projectsSource.IndexOf(proj); // this fails since proj has changed after refresh (timestamp or other data) + // if currently editing field, cancel it (otherwise crash) + IEditableCollectionView itemsView = gridRecent.Items; + if (itemsView.IsAddingNew || itemsView.IsEditingItem) + { + gridRecent.CancelEdit(DataGridEditingUnit.Cell); + } + // FIXME nobody likes extra loops.. but only 40 items to find correct project? but still.. for (int i = 0, len = projectsSource.Count; i < len; i++) {