Skip to content

Commit 4a706ec

Browse files
committed
Improve restart reliability, closes #855.
1 parent e7508b9 commit 4a706ec

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

FlashDevelop/MainForm.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,14 +1034,14 @@ private void InitializeComponents()
10341034
this.Font = this.appSettings.DefaultFont;
10351035
this.StartPosition = FormStartPosition.Manual;
10361036
this.Closing += new CancelEventHandler(this.OnMainFormClosing);
1037+
this.FormClosed += new FormClosedEventHandler(this.OnMainFormClosed);
10371038
this.Activated += new EventHandler(this.OnMainFormActivate);
10381039
this.Shown += new EventHandler(this.OnMainFormShow);
10391040
this.Load += new EventHandler(this.OnMainFormLoad);
10401041
this.LocationChanged += new EventHandler(this.OnMainFormLocationChange);
10411042
this.GotFocus += new EventHandler(this.OnMainFormGotFocus);
10421043
this.Resize += new EventHandler(this.OnMainFormResize);
1043-
1044-
ScintillaManager.ConfigurationLoaded += ApplyAllSettings;
1044+
ScintillaManager.ConfigurationLoaded += this.ApplyAllSettings;
10451045
}
10461046

10471047
#endregion
@@ -1216,16 +1216,23 @@ public void OnMainFormClosing(Object sender, System.ComponentModel.CancelEventAr
12161216
PluginServices.DisposePlugins();
12171217
this.KillProcess();
12181218
this.SaveAllSettings();
1219-
/* Restart if requested */
1220-
if (this.restartRequested)
1221-
{
1222-
this.restartRequested = false;
1223-
Application.Restart();
1224-
}
12251219
}
12261220
else this.restartRequested = false;
12271221
}
12281222

1223+
/// <summary>
1224+
/// When form is closed restart if requested.
1225+
/// </summary>
1226+
public void OnMainFormClosed(Object sender, FormClosedEventArgs e)
1227+
{
1228+
if (this.restartRequested)
1229+
{
1230+
this.restartRequested = false;
1231+
Process.Start(Application.ExecutablePath);
1232+
Process.GetCurrentProcess().Kill();
1233+
}
1234+
}
1235+
12291236
/// <summary>
12301237
/// When dock changes, applies the padding to documents
12311238
/// </summary>

0 commit comments

Comments
 (0)