aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-03 19:44:01 -0500
committerMichael <[email protected]>2017-02-03 19:44:01 -0500
commit318fef283e57221349eb6412db63d63399f4fb86 (patch)
treefb5850eebc36800909516cc09f2ca89631f478fd /ShiftOS_TheReturn
parent7edc0f10bb79453fdc3bf885cbd21be40f7839b5 (diff)
downloadshiftos_thereturn-318fef283e57221349eb6412db63d63399f4fb86.tar.gz
shiftos_thereturn-318fef283e57221349eb6412db63d63399f4fb86.tar.bz2
shiftos_thereturn-318fef283e57221349eb6412db63d63399f4fb86.zip
Fix crash handler
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/AudioManager.cs8
-rw-r--r--ShiftOS_TheReturn/CrashHandler.cs18
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs5
3 files changed, 18 insertions, 13 deletions
diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs
index 5923aa1..1ea4575 100644
--- a/ShiftOS_TheReturn/AudioManager.cs
+++ b/ShiftOS_TheReturn/AudioManager.cs
@@ -67,7 +67,13 @@ namespace ShiftOS.Engine
_out.Volume = volume;
}
-
+ internal static void Kill()
+ {
+ _running = false;
+ _out.Stop();
+ _out.Dispose();
+ _reader.Dispose();
+ }
}
public interface IAudioProvider
diff --git a/ShiftOS_TheReturn/CrashHandler.cs b/ShiftOS_TheReturn/CrashHandler.cs
index 331a55a..a723136 100644
--- a/ShiftOS_TheReturn/CrashHandler.cs
+++ b/ShiftOS_TheReturn/CrashHandler.cs
@@ -95,20 +95,14 @@ namespace ShiftOS.Engine
public static void Start(Exception e)
{
- if (SaveSystem.CurrentSave != null)
- {
- TerminalBackend.InvokeCommand("sos.save"); //save ShiftOS to disk before killing the session
- }
-
- //Close ALL FORMS in the current session.
- while (Application.OpenForms.Count != 0)
- {
- Application.OpenForms[0].Dispose();
- }
-
- //Disconnect us from the ShiftOS multi-user domain.
+ if(SaveSystem.CurrentSave != null)
+ TerminalBackend.InvokeCommand("sos.save");
+ AudioManager.Kill();
ServerManager.Disconnect();
+ while (Application.OpenForms.Count > 0)
+ Application.OpenForms[0].Close();
+
//Set our global exception variable, and show the exception dialog.
HandledException = e;
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index 4934221..d2cc521 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -58,6 +58,11 @@ namespace ShiftOS.Engine
/// <param name="useDefaultUI">Whether ShiftOS should initiate it's Windows Forms front-end.</param>
public static void Begin(bool useDefaultUI = true)
{
+ AppDomain.CurrentDomain.UnhandledException += (o, a) =>
+ {
+ CrashHandler.Start((Exception)a.ExceptionObject);
+ };
+
if (!System.IO.File.Exists(Paths.SaveFile))
{
var root = new ShiftOS.Objects.ShiftFS.Directory();