Fix exception on shutdown
Improve error handling during shutdown
This commit is contained in:
1 parent
2371eb4344
commit
b8bd9bf87b
4 files changed
+12
-6
No files matched your search
@@ -130,7 +130,7 @@ namespace Vocaluxe.Base
|
|||||||
_Initialized = true;
|
_Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CloseAll()
|
public static void Close()
|
||||||
{
|
{
|
||||||
if (_Initialized)
|
if (_Initialized)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Vocaluxe.Base.ThemeSystem
|
|||||||
|
|
||||||
public static void Unload()
|
public static void Unload()
|
||||||
{
|
{
|
||||||
foreach (CBaseTheme theme in _Themes)
|
foreach (CTheme theme in _Themes)
|
||||||
theme.Unload();
|
theme.Unload();
|
||||||
CurrentThemes.Clear();
|
CurrentThemes.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Vocaluxe.Lib.Sound.Playback
|
|||||||
{
|
{
|
||||||
if (!_Initialized)
|
if (!_Initialized)
|
||||||
return -1;
|
return -1;
|
||||||
IAudioStream stream = _CreateStream(_NextID, medium, loop);
|
IAudioStream stream = _CreateStream(_NextID++, medium, loop);
|
||||||
|
|
||||||
if (stream.Open(prescan))
|
if (stream.Open(prescan))
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,6 @@ namespace Vocaluxe.Lib.Sound.Playback
|
|||||||
stream.VolumeMax = _GlobalVolume;
|
stream.VolumeMax = _GlobalVolume;
|
||||||
stream.SetOnCloseListener(this);
|
stream.SetOnCloseListener(this);
|
||||||
_Streams.Add(stream);
|
_Streams.Add(stream);
|
||||||
_NextID++;
|
|
||||||
return stream.ID;
|
return stream.ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-2
@@ -279,8 +279,15 @@ namespace Vocaluxe
|
|||||||
CRecord.Close();
|
CRecord.Close();
|
||||||
CSound.Close();
|
CSound.Close();
|
||||||
CDraw.Close();
|
CDraw.Close();
|
||||||
GC.Collect(); // Do a GC run here before we close logs to have finalizers run
|
}
|
||||||
CLog.CloseAll(); // Do this last, so we get all log entries!
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown!", false, false, e);
|
||||||
|
}
|
||||||
|
GC.Collect(); // Do a GC run here before we close logs to have finalizers run
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CLog.Close(); // Do this last, so we get all log entries!
|
||||||
}
|
}
|
||||||
catch (Exception) {}
|
catch (Exception) {}
|
||||||
Environment.Exit(Environment.ExitCode);
|
Environment.Exit(Environment.ExitCode);
|
||||||
|
|||||||
Reference in new issue
Block a user