diff --git a/xbmc/cores/VideoPlayer/VideoReferenceClock.cpp b/xbmc/cores/VideoPlayer/VideoReferenceClock.cpp index 5977ee4aceb2c..ad8d76ce4236d 100644 --- a/xbmc/cores/VideoPlayer/VideoReferenceClock.cpp +++ b/xbmc/cores/VideoPlayer/VideoReferenceClock.cpp @@ -37,6 +37,7 @@ CVideoReferenceClock::CVideoReferenceClock() : CThread("RefClock") CVideoReferenceClock::~CVideoReferenceClock() { + m_destructing = true; m_vsyncStopEvent.Set(); StopThread(); } @@ -108,7 +109,7 @@ void CVideoReferenceClock::Process() m_pVideoSync.reset(); } - if (!SetupSuccess) + if (!SetupSuccess || m_destructing) break; } } diff --git a/xbmc/cores/VideoPlayer/VideoReferenceClock.h b/xbmc/cores/VideoPlayer/VideoReferenceClock.h index 4419b6dc4476e..5968b4036fe21 100644 --- a/xbmc/cores/VideoPlayer/VideoReferenceClock.h +++ b/xbmc/cores/VideoPlayer/VideoReferenceClock.h @@ -37,6 +37,8 @@ class CVideoReferenceClock : CThread int64_t TimeOfNextVblank() const; static void CBUpdateClock(int NrVBlanks, uint64_t time, void *clock); + bool m_destructing = false; + int64_t m_CurrTime; //the current time of the clock when using vblank as clock source int64_t m_LastIntTime; //last interpolated clock value, to make sure the clock doesn't go backwards double m_CurrTimeFract; //fractional part that is lost due to rounding when updating the clock