summaryrefslogtreecommitdiff
path: root/src/drumkitloader.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-04-07 13:01:34 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-04-07 13:01:34 +0200
commit331be8dc452bf47705556d2a7f7f5988973930ca (patch)
tree164a30fd5cef68a39713315085da8bd7901a1d07 /src/drumkitloader.cc
parent064f0112bd825f1102a94e109e5329710d59eb82 (diff)
Fixed crashbug on drumkit reload.
Diffstat (limited to 'src/drumkitloader.cc')
-rw-r--r--src/drumkitloader.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc
index ed1a187..45dcec3 100644
--- a/src/drumkitloader.cc
+++ b/src/drumkitloader.cc
@@ -68,6 +68,7 @@ void DrumKitLoader::loadKit(DrumKit *kit)
}
+
void DrumKitLoader::thread_main()
{
while(1) {
@@ -79,10 +80,14 @@ void DrumKitLoader::thread_main()
if(quitit) return;
unsigned int count = 0;
+
+ if(!kit->isValid()) goto finish;
+
{ // Count total number of files that need loading:
Instruments::iterator i = kit->instruments.begin();
while(i != kit->instruments.end()) {
Instrument *instr = *i;
+ if(!instr->isValid()) goto finish;
count += instr->audiofiles.size();
i++;
@@ -95,6 +100,8 @@ void DrumKitLoader::thread_main()
while(i != kit->instruments.end()) {
Instrument *instr = *i;
+ if(!instr->isValid()) goto finish;
+
std::vector<AudioFile*>::iterator a = instr->audiofiles.begin();
while(a != instr->audiofiles.end()) {
#if 0
@@ -105,6 +112,9 @@ void DrumKitLoader::thread_main()
#endif/*WIN32*/
#endif
AudioFile *af = *a;
+
+ if(!af->isValid()) goto finish;
+
af->load();
loaded++;
@@ -124,6 +134,9 @@ void DrumKitLoader::thread_main()
mutex.lock();
is_done = true;
mutex.unlock();
+
+ finish:
+ continue;
}
}