main: Simplify uncaught exception handling. #1539
This commit is contained in:
parent
3fd5e7cd0d
commit
2c255ad7a6
|
@ -67,20 +67,14 @@ namespace SparkleShare {
|
||||||
Environment.Exit (-1);
|
Environment.Exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
|
||||||
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
|
|
||||||
|
|
||||||
Controller = new SparkleController ();
|
Controller = new SparkleController ();
|
||||||
Controller.Initialize ();
|
Controller.Initialize ();
|
||||||
|
|
||||||
|
UI = new SparkleUI ();
|
||||||
|
UI.Run ();
|
||||||
|
|
||||||
UI = new SparkleUI ();
|
|
||||||
UI.Run ();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
SparkleLogger.WriteCrashReport (e);
|
|
||||||
Environment.Exit (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !__MonoCS__
|
#if !__MonoCS__
|
||||||
// Suppress assertion messages in debug mode
|
// Suppress assertion messages in debug mode
|
||||||
GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
|
GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
|
||||||
|
@ -88,15 +82,13 @@ namespace SparkleShare {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnUnhandledException(object sender, UnhandledExceptionEventArgs exception_args)
|
private static void OnUnhandledException (object sender, UnhandledExceptionEventArgs exception_args)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
Exception e = (Exception) exception_args.ExceptionObject;
|
||||||
var e = (Exception)exception_args.ExceptionObject;
|
SparkleLogger.WriteCrashReport (e);
|
||||||
SparkleLogger.WriteCrashReport(e);
|
|
||||||
}
|
} finally {
|
||||||
finally
|
|
||||||
{
|
|
||||||
Environment.Exit (-1);
|
Environment.Exit (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue