From f0e98151f117beb773449332b4a30df765f0fddb Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 30 Nov 2011 04:28:03 +0000 Subject: [PATCH] Close audio if an error occurs while announcing the opened audio as the program is probably in an inconsistent state Originally committed to SVN as r5946. --- aegisub/src/audio_controller.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/aegisub/src/audio_controller.cpp b/aegisub/src/audio_controller.cpp index be97df39f..a8a959e56 100644 --- a/aegisub/src/audio_controller.cpp +++ b/aegisub/src/audio_controller.cpp @@ -331,8 +331,16 @@ void AudioController::OpenAudio(const wxString &url) video_position_marker_provider->AddMarkerMovedListener(std::tr1::bind(std::tr1::ref(AnnounceMarkerMoved))); } - // Tell listeners about this. - AnnounceAudioOpen(provider); + try + { + // Tell listeners about this. + AnnounceAudioOpen(provider); + } + catch (...) + { + CloseAudio(); + throw; + } }