Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 336ed70

Browse files
committed
Fixed freeze on unsaved file tab close
- Fixed a bug where SPedit would freeze if a unsaved file is about to be closed.
1 parent bc4dc9a commit 336ed70

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

UI/Components/EditorElement.xaml.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ public void MoveLine(bool down)
492492
}
493493
}
494494

495-
public void Close(bool ForcedToSave = false, bool CheckSavings = true)
495+
public async void Close(bool ForcedToSave = false, bool CheckSavings = true)
496496
{
497497
regularyTimer.Stop();
498498
regularyTimer.Close();
@@ -512,9 +512,10 @@ public void Close(bool ForcedToSave = false, bool CheckSavings = true)
512512
}
513513
else
514514
{
515-
var Result = Program.MainWindow.ShowMessageAsync($"{Program.Translations.GetLanguage("SavingFile")} '" + Parent.Title.Trim(new char[] { '*' }) + "'", "", MessageDialogStyle.AffirmativeAndNegative, Program.MainWindow.MetroDialogOptions);
516-
Result.Wait();
517-
if (Result.Result == MessageDialogResult.Affirmative)
515+
string title = $"{Program.Translations.GetLanguage("SavingFile")} '" + Parent.Title.Trim(new char[] { '*' }) + "'";
516+
string msg = "";
517+
MessageDialogResult Result = await Program.MainWindow.ShowMessageAsync(title, msg, MessageDialogStyle.AffirmativeAndNegative, Program.MainWindow.MetroDialogOptions);
518+
if (Result == MessageDialogResult.Affirmative)
518519
{
519520
Save();
520521
}

0 commit comments

Comments
 (0)