Reduce how long the CSRI lock is held

Originally committed to SVN as r6699.
This commit is contained in:
Thomas Goyne 2012-04-14 03:17:22 +00:00
parent 24fde36e7f
commit 0f9289dc0f
1 changed files with 4 additions and 3 deletions

View File

@ -83,12 +83,11 @@ CSRISubtitlesProvider::~CSRISubtitlesProvider() {
}
void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
wxMutexLocker lock(csri_mutex);
// Open from memory
if (can_open_mem) {
std::vector<char> data;
subs->SaveMemory(data);
wxMutexLocker lock(csri_mutex);
instance = csri_open_mem(renderer, &data[0], data.size(), NULL);
}
// Open from disk
@ -99,6 +98,8 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
tempfile += ".ass";
}
subs->Save(tempfile, false, false, wxSTRING_ENCODING);
wxMutexLocker lock(csri_mutex);
instance = csri_open_file(renderer, tempfile.utf8_str(), NULL);
}
}