From 01529c57413b66eae0f5880b2886e932496c41cc Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sat, 28 Dec 2013 23:10:43 +0100 Subject: [PATCH] Audio: Fix stream not being unlocked on exception --- src/audio.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/audio.cpp b/src/audio.cpp index 3aa69bd..a3e27dc 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -1273,7 +1273,19 @@ struct AudioStream stream.close(); case ALStream::Closed : if (diffFile) - stream.open(filename); + { + try + { + /* This will throw on errors while + * opening the data source */ + stream.open(filename); + } + catch (const Exception &e) + { + unlockStream(); + throw e; + } + } break; }