[totem/gnome-2-26] Fix race in GstXOverlay discovery/use



commit 84406bd8c461919c023cba4d958b8b7ca5f31d9c
Author: Jan Schmidt <thaytan noraisin net>
Date:   Wed May 13 13:10:39 2009 +0100

    Fix race in GstXOverlay discovery/use
    
    2009-05-13  Jan Schmidt  <thaytan noraisin net>
    
            * src/backend/bacon-video-widget-gst-0.10.c (bvw_element_msg_sync):
            Avoid a race with xoverlay interface discovery. Because the
            update_interface implementations function only searches for interfaces
            from the main gui thread, there's a race when the sync_msg comes in
            requesting an xid to embed and the xoverlay interface isn't available
            until the gui thread updates it.
    
            Avoid the race by using the sender of the message when it (as it
            always should) implements the GstXOverlay interface.
---
 ChangeLog                                 |   12 ++++++++++++
 src/backend/bacon-video-widget-gst-0.10.c |    5 +++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9022ff9..5aef8d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-05-13  Jan Schmidt  <thaytan noraisin net>
+
+	* src/backend/bacon-video-widget-gst-0.10.c (bvw_element_msg_sync):
+	Avoid a race with xoverlay interface discovery. Because the
+	update_interface implementations function only searches for interfaces
+	from the main gui thread, there's a race when the sync_msg comes in
+	requesting an xid to embed and the xoverlay interface isn't available
+	until the gui thread updates it.
+
+	Avoid the race by using the sender of the message when it (as it
+	always should) implements the GstXOverlay interface.
+
 ============ Version 2.26.2
 
 2009-05-03  Bastien Nocera  <hadess hadess net>
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 6876679..e43e068 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -4914,6 +4914,11 @@ bvw_element_msg_sync (GstBus *bus, GstMessage *msg, gpointer data)
 
     g_mutex_lock (bvw->priv->lock);
     bvw_update_interface_implementations (bvw);
+    if (bvw->priv->xoverlay == NULL) {
+      GstObject *sender = GST_MESSAGE_SRC (msg);
+      if (sender && GST_IS_X_OVERLAY (sender))
+        bvw->priv->xoverlay = GST_X_OVERLAY (gst_object_ref (sender));
+    }
     g_mutex_unlock (bvw->priv->lock);
 
     g_return_if_fail (bvw->priv->xoverlay != NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]