Skip to content

Commit 7b5afe3

Browse files
committed
added timeout for shutdown in case components aren't disposed properly
1 parent 63b327a commit 7b5afe3

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

Project-Aurora/Project-Aurora/App.xaml.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,18 @@ protected override void OnExit(ExitEventArgs e)
284284
Global.dev_manager?.Dispose();
285285
Environment.ExitCode = 0;
286286

287-
//ShutdownApp(0);
287+
var thread = new Thread(() =>
288+
{
289+
var stopwatch = new Stopwatch();
290+
stopwatch.Start();
291+
Thread.Sleep(5000);
292+
if (stopwatch.ElapsedMilliseconds > 4500) {
293+
ShutdownApp(0);
294+
}
295+
});
296+
thread.IsBackground = true;
297+
thread.Name = "Exit timer";
298+
thread.Start();
288299
}
289300

290301
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)

0 commit comments

Comments
 (0)