Permalink
Browse files

paplayer: fix race between player destruction and queue next file

  • Loading branch information...
1 parent 167c80b commit 78b8730d53e6011ef717f2e28aaddef2acb4d10d @FernetMenta FernetMenta committed Jan 30, 2014
Showing with 12 additions and 11 deletions.
  1. +12 −11 xbmc/cores/paplayer/PAPlayer.cpp
@@ -520,6 +520,18 @@ bool PAPlayer::CloseFile(bool reopen)
/* wait for the thread to terminate */
StopThread(true);//true - wait for end of thread
+
+ // wait for any pending jobs to complete
+ {
+ CSharedLock lock(m_streamsLock);
+ while (m_jobCounter > 0)
+ {
+ lock.Leave();
+ m_jobEvent.WaitMSec(100);
+ lock.Enter();
+ }
+ }
+
return true;
}
@@ -553,17 +565,6 @@ void PAPlayer::Process()
GetTimeInternal(); //update for GUI
}
- // wait for any pending jobs to complete
- {
- CSharedLock lock(m_streamsLock);
- while (m_jobCounter > 0)
- {
- lock.Leave();
- m_jobEvent.WaitMSec(100);
- lock.Enter();
- }
- }
-
if(m_isFinished && !m_bStop)
m_callback.OnPlayBackEnded();
else

0 comments on commit 78b8730

Please sign in to comment.