--- xvimagesink.c.orig	2006-11-29 21:35:26.000000000 +0200
+++ xvimagesink.c	2006-12-08 12:49:33.000000000 +0200
@@ -1685,6 +1685,8 @@
     gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (xvimagesink));
   }
 
+  g_mutex_lock (xvimagesink->flow_lock);
+
   /* Creating our window and our image with the display size in pixels */
   g_assert (GST_VIDEO_SINK_WIDTH (xvimagesink) > 0);
   g_assert (GST_VIDEO_SINK_HEIGHT (xvimagesink) > 0);
@@ -1693,6 +1695,8 @@
         GST_VIDEO_SINK_WIDTH (xvimagesink),
         GST_VIDEO_SINK_HEIGHT (xvimagesink));
 
+  g_mutex_unlock (xvimagesink->flow_lock);
+
   /* We renew our xvimage only if size or format changed;
    * the xvimage is the same size as the video pixel size */
   if ((xvimagesink->xvimage) &&
