Commit 37840764 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

win32: inhibit: Ensure we restore the state when cancelled

parent ccc3b13f
......@@ -49,6 +49,13 @@ static void Inhibit (vlc_inhibit_t *ih, unsigned mask)
vlc_cond_signal(&sys->cond);
}
static void RestoreStateOnCancel( void* p_opaque )
{
VLC_UNUSED(p_opaque);
SetThreadExecutionState( ES_CONTINUOUS );
msg_Err( (vlc_object_t*)p_opaque, "Restored context" );
}
static void* Run(void* obj)
{
vlc_inhibit_t *ih = (vlc_inhibit_t*)obj;
......@@ -62,12 +69,14 @@ static void* Run(void* obj)
vlc_mutex_lock(&sys->mutex);
mutex_cleanup_push(&sys->mutex);
vlc_cleanup_push(RestoreStateOnCancel, ih);
while (!sys->signaled)
vlc_cond_wait(&sys->cond, &sys->mutex);
mask = sys->mask;
sys->signaled = false;
vlc_mutex_unlock(&sys->mutex);
vlc_cleanup_pop();
vlc_cleanup_pop();
bool suspend = (mask & VLC_INHIBIT_DISPLAY) != 0;
if (suspend)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment