After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 750199 - glimagesink: crashes in gst_gl_window_x11_set_window_handle()
glimagesink: crashes in gst_gl_window_x11_set_window_handle()
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 750209 (view as bug list)
Depends on:
Reported: 2015-06-01 05:15 UTC by Jan Schmidt
Modified: 2015-06-02 02:34 UTC
See Also:
GNOME target: ---
GNOME version: ---

Description Jan Schmidt 2015-06-01 05:15:48 UTC
Since recent-ish master (since ~ 27th May) I get crashes at startup using any of the GL Gtk examples, trying to do X operations on a NULL Display. It looks like gst_gl_window_x11_set_window_handle() does X operations before gst_gl_window_x11_open() has happened.

Program received signal SIGSEGV, Segmentation fault.
XGetWindowAttributes (dpy=0x0, w=w@entry=33554445, attr=attr@entry=0x7fffffffa210) at GetWAttrs.c:148
148	    LockDisplay(dpy);
Missing separate debuginfos, use: dnf debuginfo-install at-spi2-atk-2.16.0-1.fc22.x86_64 at-spi2-core-2.16.0-1.fc22.x86_64 bzip2-libs-1.0.6-14.fc22.x86_64 dbus-libs-1.8.18-1.fc22.x86_64 elfutils-libelf-0.161-6.fc22.x86_64 elfutils-libs-0.161-6.fc22.x86_64 expat-2.1.0-10.fc22.x86_64 graphite2-1.2.4-3.fc22.x86_64 gtk3-3.16.3-1.fc22.x86_64 gvfs-1.24.1-1.fc22.x86_64 harfbuzz-0.9.40-1.fc22.x86_64 libattr-2.4.47-9.fc22.x86_64 libbluray-0.7.0-1.fc22.x86_64 libcanberra-0.30-7.fc22.x86_64 libcanberra-gtk3-0.30-7.fc22.x86_64 libcap-2.24-7.fc22.x86_64 libdrm-2.4.61-3.fc22.x86_64 libepoxy-1.2-1.fc22.x86_64 libffi-3.1-7.fc22.x86_64 libgcc-5.1.1-1.fc22.x86_64 libjpeg-turbo-1.4.0-1.fc22.x86_64 libogg-1.3.2-2.fc22.x86_64 libpng-1.6.16-3.fc22.x86_64 libselinux-2.3-10.fc22.x86_64 libstdc++-5.1.1-1.fc22.x86_64 libtdb-1.3.4-1.fc22.x86_64 libtool-ltdl-2.4.2-34.fc22.x86_64 libvorbis-1.3.4-3.fc22.x86_64 libwayland-client-1.7.0-1.fc22.x86_64 libwayland-cursor-1.7.0-1.fc22.x86_64 libwayland-server-1.7.0-1.fc22.x86_64 libXau-1.0.8-4.fc22.x86_64 libxcb-1.11-5.fc22.x86_64 libXcomposite-0.4.4-6.fc22.x86_64 libXcursor-1.1.14-4.fc22.x86_64 libXdamage-1.1.4-6.fc22.x86_64 libXfixes-5.0.1-4.fc22.x86_64 libXi-1.7.4-2.fc22.x86_64 libXinerama-1.1.3-4.fc22.x86_64 libxkbcommon-0.5.0-1.fc22.x86_64 libxml2-2.9.2-3.fc22.x86_64 libXrandr-1.4.2-2.fc22.x86_64 libXrender-0.9.9-1.fc22.x86_64 libxshmfence-1.2-1.fc22.x86_64 libXxf86vm-1.1.4-1.fc22.x86_64 nss-softokn-freebl-3.19.0-1.0.fc22.x86_64 PackageKit-gtk3-module-1.0.6-4.fc22.x86_64 pcre-8.37-1.fc22.x86_64 pixman-0.32.6-4.fc22.x86_64 systemd-libs-219-15.fc22.x86_64 xz-libs-5.2.0-2.fc22.x86_64
(gdb) bt
  • #0 XGetWindowAttributes
    at GetWAttrs.c line 148
  • #1 gst_gl_window_x11_set_window_handle
    at gstglwindow_x11.c line 319
  • #2 _set_window_handle_cb
    at gstglwindow.c line 369
  • #3 _run_message_async
    at gstglwindow.c line 695
  • #4 g_main_context_invoke_full
    at gmain.c line 5593
  • #5 _ensure_gl_setup
    at gstglimagesink.c line 805
  • #6 gst_glimage_sink_change_state
    at gstglimagesink.c line 986
  • #7 gst_element_change_state
    at gstelement.c line 2604

Comment 1 Jan Schmidt 2015-06-01 05:16:14 UTC
diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c
index 4317d48..78b3fdc 100644
--- a/gst-libs/gst/gl/x11/gstglwindow_x11.c
+++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c
@@ -316,6 +316,9 @@ gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id)
   window_x11->parent_win = (Window) id;
+  if (window_x11->device == NULL)
+    window_x11->device = XOpenDisplay (NULL);
   XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr);
   XResizeWindow (window_x11->device, window_x11->internal_win_id,

Is enough to make things run, without being anything like a correct fix.
Comment 2 Matthew Waters (ystreet00) 2015-06-01 08:26:48 UTC
Yea, so the problem is that

commit c5f8c789a3b87c01529b9298c1940e2b08fe4c66
Author: Julien Isorce <>
Date:   Wed May 27 14:10:16 2015 +0100

    glwindow_x11: use parent default implementation


commit bc7a7259f357b0065dd94e0668b5a895d83fa53a
Author: Matthew Waters <>
Date:   Fri Mar 6 15:31:18 2015 +1100

    gl/window: create the main loop/context on init/finalize
    Avoids races setting the window handle from the main thread.
Comment 3 Julien Isorce 2015-06-01 09:16:30 UTC
Hi, sorry about that, I'll move loop/context to gstglwindow.c::init/finalize to preserve previous behavior. Unless you started to do it so let me know.
Comment 4 Matthew Waters (ystreet00) 2015-06-01 11:26:55 UTC
Go ahead :)
Comment 5 Thibault Saunier 2015-06-01 12:25:11 UTC
*** Bug 750209 has been marked as a duplicate of this bug. ***
Comment 6 Julien Isorce 2015-06-01 13:12:30 UTC
commit d843b9e8c3119fe92a6a583860aa6f771cdc217c
Author: Julien Isorce <>
Date:   Mon Jun 1 12:58:11 2015 +0100

    glwindow: move main loop/context creation back to init/finalize

Please try with current master and let me know if something is still broken.
Comment 7 Thibault Saunier 2015-06-01 14:43:23 UTC
> Please try with current master and let me know if something is still broken.

Looks good here :)