vlc | branch: master | Hugo Beauzée-Luyssen <h...@beauzee.fr> | Tue Feb 13 
11:09:24 2018 +0100| [3784076449bf9fabd146710908013496befd9700] | committer: 
Hugo Beauzée-Luyssen

win32: inhibit: Ensure we restore the state when cancelled

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3784076449bf9fabd146710908013496befd9700
---

 modules/video_output/win32/inhibit.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/video_output/win32/inhibit.c 
b/modules/video_output/win32/inhibit.c
index aae006daaa..7a4ce0053a 100644
--- a/modules/video_output/win32/inhibit.c
+++ b/modules/video_output/win32/inhibit.c
@@ -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)

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to