Skip to content

Commit

Permalink
Update OptionsFormLauncher.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Aug 8, 2021
1 parent 95b422f commit e3d052f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/DiffEngineTray/Settings/OptionsFormLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
static class OptionsFormLauncher
{
static OptionsForm? instance;
static EventHandler formOnClosed = Form_Closed;
static EventHandler formOnClosed = (_, _) =>
{
instance!.Closed -= formOnClosed;
instance = null;
};

public static async Task Launch(KeyRegister keyRegister, Tracker tracker)
{
Expand All @@ -23,12 +27,6 @@ public static async Task Launch(KeyRegister keyRegister, Tracker tracker)
form.ShowDialog();
}

static void Form_Closed(object? sender, EventArgs e)
{
instance!.Closed -= formOnClosed;
instance = null;
}

static async Task<IReadOnlyList<string>> Save(KeyRegister keyRegister, Tracker tracker, Settings settings)
{
if (!settings.IsValidate(out var errors))
Expand Down

0 comments on commit e3d052f

Please sign in to comment.