[vlc-commits] win32: inhibit: Ensure we restore the state when cancelled

Hugo Beauzée-Luyssen git at videolan.org
Tue Feb 13 11:18:06 CET 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at 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)



More information about the vlc-commits mailing list