mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(OnPlaybackStopped): NAudio occasionally throws an exception in Dispose.
This commit is contained in:
@@ -132,9 +132,17 @@ namespace GARbro.GUI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void OnClosing (CancelEventArgs e)
|
protected override void OnClosing (CancelEventArgs e)
|
||||||
{
|
{
|
||||||
AudioDevice = null;
|
try
|
||||||
CurrentAudio = null;
|
{
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
AudioDevice = null;
|
||||||
|
CurrentAudio = null;
|
||||||
|
}
|
||||||
|
catch (Exception X)
|
||||||
|
{
|
||||||
|
Trace.WriteLine (X.Message, "[OnClosing]");
|
||||||
|
Trace.WriteLine (X.StackTrace, "Stack trace");
|
||||||
|
}
|
||||||
base.OnClosing (e);
|
base.OnClosing (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,9 +851,10 @@ namespace GARbro.GUI
|
|||||||
get { return m_audio_device; }
|
get { return m_audio_device; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_audio_device != null)
|
var old_value = m_audio_device;
|
||||||
m_audio_device.Dispose();
|
|
||||||
m_audio_device = value;
|
m_audio_device = value;
|
||||||
|
if (old_value != null)
|
||||||
|
old_value.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -855,9 +864,10 @@ namespace GARbro.GUI
|
|||||||
get { return m_audio_input; }
|
get { return m_audio_input; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_audio_input != null)
|
var old_value = m_audio_input;
|
||||||
m_audio_input.Dispose();
|
|
||||||
m_audio_input = value;
|
m_audio_input = value;
|
||||||
|
if (old_value != null)
|
||||||
|
old_value.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -904,8 +914,15 @@ namespace GARbro.GUI
|
|||||||
|
|
||||||
private void OnPlaybackStopped (object sender, StoppedEventArgs e)
|
private void OnPlaybackStopped (object sender, StoppedEventArgs e)
|
||||||
{
|
{
|
||||||
SetResourceText ("");
|
try
|
||||||
CurrentAudio = null;
|
{
|
||||||
|
SetResourceText ("");
|
||||||
|
CurrentAudio = null;
|
||||||
|
}
|
||||||
|
catch (Exception X)
|
||||||
|
{
|
||||||
|
Trace.WriteLine (X.Message, "[OnPlaybackStopped]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user