From 7b4b755e17ad3e6022bc2fa605065d2dd93ca68e Mon Sep 17 00:00:00 2001 From: morkt Date: Mon, 17 Oct 2016 11:14:42 +0400 Subject: [PATCH] (PlayFile): don't dispose stream on successful open. --- GUI/MainWindow.xaml.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GUI/MainWindow.xaml.cs b/GUI/MainWindow.xaml.cs index efc6b9ef..2daefe02 100644 --- a/GUI/MainWindow.xaml.cs +++ b/GUI/MainWindow.xaml.cs @@ -924,7 +924,8 @@ namespace GARbro.GUI try { SetBusyState(); - using (var input = VFS.OpenBinaryStream (entry)) + var input = VFS.OpenBinaryStream (entry); + try { FormatCatalog.Instance.LastError = null; sound = AudioFormat.Read (input); @@ -945,11 +946,17 @@ namespace GARbro.GUI AudioDevice.Init (CurrentAudio); AudioDevice.PlaybackStopped += OnPlaybackStopped; AudioDevice.Play(); + input = null; var fmt = CurrentAudio.WaveFormat; SetResourceText (string.Format (guiStrings.MsgPlaying, entry.Name, fmt.SampleRate, sound.SourceBitrate / 1000, CurrentAudio.TotalTime.ToString ("m':'ss"))); } + finally + { + if (input != null) + input.Dispose(); + } } catch (Exception X) {