aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2009-09-14 09:33:06 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-09-14 16:27:12 +0800
commitddcb7848002b70bc8950d45a9079582a8787c394 (patch)
tree7fa336aa919d43073869d527b7992a66f086fb72
parent38cf0499b0329c0556cb2adc2460fb234c596a43 (diff)
downloadgsoc2013-empathy-ddcb7848002b70bc8950d45a9079582a8787c394.tar
gsoc2013-empathy-ddcb7848002b70bc8950d45a9079582a8787c394.tar.gz
gsoc2013-empathy-ddcb7848002b70bc8950d45a9079582a8787c394.tar.bz2
gsoc2013-empathy-ddcb7848002b70bc8950d45a9079582a8787c394.tar.lz
gsoc2013-empathy-ddcb7848002b70bc8950d45a9079582a8787c394.tar.xz
gsoc2013-empathy-ddcb7848002b70bc8950d45a9079582a8787c394.tar.zst
gsoc2013-empathy-ddcb7848002b70bc8950d45a9079582a8787c394.zip
[EmpathyVideoWidget] fix X crash when using Empathy with GTK+ c-s-w
In client-side-windows enabled GTK+, a call to GDK_WINDOW_XID() implicitly calls gdk_window_ensure_native() so that a native X11 window exists serverside to have an XID for. Calling gdk_window_ensure_native() from a thread is not awesome and causes Empathy to abort with one of several X errors. The fix is to call GDK_WINDOW_XID() as soon as the widget is realized, before the XID is requested from a thread (it would be neater to call gdk_window_ensure_native() here, but that would force us to require GTK+ 2.18, which we don't want to do). Fixes gnome bug #594890
-rw-r--r--libempathy-gtk/empathy-video-widget.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-video-widget.c b/libempathy-gtk/empathy-video-widget.c
index 0f62496de..915aa33da 100644
--- a/libempathy-gtk/empathy-video-widget.c
+++ b/libempathy-gtk/empathy-video-widget.c
@@ -100,12 +100,25 @@ empathy_video_widget_init (EmpathyVideoWidget *obj)
}
static void
+empathy_video_widget_realized (GtkWidget *widget, gpointer user_data)
+{
+ /* requesting the XID forces the GdkWindow to be native in GTK+ 2.18
+ * onwards, requesting the native window in a thread causes a BadWindowID,
+ * so we need to request it now. We could call gdk_window_ensure_native(),
+ * but that would mean we require GTK+ 2.18, so instead we call this */
+ GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (widget)));
+}
+
+static void
empathy_video_widget_constructed (GObject *object)
{
EmpathyVideoWidgetPriv *priv = GET_PRIV (object);
GstElement *colorspace, *videoscale, *sink;
GstPad *pad;
+ g_signal_connect (object, "realize",
+ G_CALLBACK (empathy_video_widget_realized), NULL);
+
priv->videosink = gst_bin_new (NULL);
gst_object_ref (priv->videosink);