[Spice-devel] [PATCH spice-gtk 1/3] channel-display-gst: Protect timer_id with queue_mutex

Frediano Ziglio fziglio at redhat.com
Mon Apr 16 10:43:24 UTC 2018


timer_id is supposed to be protected by this mutex, make sure this
is true in spice_gst_decoder_reschedule.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/channel-display-gst.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 8b23036..201842e 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -438,9 +438,14 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
 static void spice_gst_decoder_reschedule(VideoDecoder *video_decoder)
 {
     SpiceGstDecoder *decoder = (SpiceGstDecoder*)video_decoder;
-    if (decoder->timer_id != 0) {
-        g_source_remove(decoder->timer_id);
-        decoder->timer_id = 0;
+
+    g_mutex_lock(&decoder->queues_mutex);
+    guint timer_id = decoder->timer_id;
+    decoder->timer_id = 0;
+    g_mutex_unlock(&decoder->queues_mutex);
+
+    if (timer_id != 0) {
+        g_source_remove(timer_id);
     }
     schedule_frame(decoder);
 }
-- 
2.14.3



More information about the Spice-devel mailing list