forked from mia/Aegisub
Fix race condition on shutdown that could result in the program not completely exiting on Windows
Originally committed to SVN as r6729.
This commit is contained in:
parent
81d1073a97
commit
2deafdd3a7
1 changed files with 10 additions and 3 deletions
|
@ -131,13 +131,16 @@ std::tr1::shared_ptr<AegiVideoFrame> ThreadedFrameSource::ProcFrame(int frameNum
|
||||||
}
|
}
|
||||||
|
|
||||||
void *ThreadedFrameSource::Entry() {
|
void *ThreadedFrameSource::Entry() {
|
||||||
while (!TestDestroy() && run) {
|
while (!TestDestroy()) {
|
||||||
double time;
|
double time;
|
||||||
int frameNum;
|
int frameNum;
|
||||||
std::auto_ptr<AssFile> newSubs;
|
std::auto_ptr<AssFile> newSubs;
|
||||||
{
|
{
|
||||||
wxMutexLocker jobLocker(jobMutex);
|
wxMutexLocker jobLocker(jobMutex);
|
||||||
|
|
||||||
|
if (!run)
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
if (nextTime == -1.) {
|
if (nextTime == -1.) {
|
||||||
jobReady.Wait();
|
jobReady.Wait();
|
||||||
continue;
|
continue;
|
||||||
|
@ -191,9 +194,13 @@ ThreadedFrameSource::ThreadedFrameSource(wxString videoFileName, wxEvtHandler *p
|
||||||
Create();
|
Create();
|
||||||
Run();
|
Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadedFrameSource::~ThreadedFrameSource() {
|
ThreadedFrameSource::~ThreadedFrameSource() {
|
||||||
run = false;
|
{
|
||||||
jobReady.Signal();
|
wxMutexLocker locker(jobMutex);
|
||||||
|
run = false;
|
||||||
|
jobReady.Signal();
|
||||||
|
}
|
||||||
Wait();
|
Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue