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 709716 - gdk_x11_screen_lookup_visual segfault on multiple X protocol screens setup
gdk_x11_screen_lookup_visual segfault on multiple X protocol screens setup
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
3.10.x
Other Linux
: High critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-10-09 09:36 UTC by farseerfc
Modified: 2013-11-26 00:39 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description farseerfc 2013-10-09 09:36:32 UTC
I am using a multiple X protocol screens setup, as I use 2 video cards with 4 monitors. Xinerama and xrandr both buggy on this setup, therefore I have no choice.
As an archlinux user, I upgraded to gtk3 3.10 recently. All gtk3 applications that have an inputbox focused segfault with this kind error:

(gnome-system-monitor:7051): Gdk-CRITICAL **: gdk_x11_screen_lookup_visual: assertion 'GDK_IS_SCREEN (screen)' failed                                
[1]    7051 segmentation fault (core dumped)  gnome-system-monitor     

Even Gimp will cause this behavior, which I thought have multiple X screens support.
Comment 1 Emmanuele Bassi (:ebassi) 2013-10-09 11:34:55 UTC
Thanks for taking the time to report this bug.
Without a stack trace from the crash it's very hard to determine what caused it.
Can you get us a stack trace? Please see http://live.gnome.org/GettingTraces for more information on how to do so. Thanks in advance!
Comment 2 farseerfc 2013-10-10 05:09:42 UTC
Of course.
I rebuild the gtk3 from ABS of Archlinux to get symbol table, then I got a stack trace when running gtk3-demo like this:

(gtk3-demo:9732): Gdk-CRITICAL **: gdk_x11_screen_lookup_visual: assertion 'GDK_IS_SCREEN (screen)' failed

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff742a4ee in gdk_x11_window_foreign_new_for_display () from /usr/lib/libgdk-3.so.0
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7f7d8c0 (LWP 9732))

  • #0 gdk_x11_window_foreign_new_for_display
    from /usr/lib/libgdk-3.so.0
  • #1 gdk_x11_display_translate_event
    from /usr/lib/libgdk-3.so.0
  • #2 _gdk_x11_event_translator_translate
    from /usr/lib/libgdk-3.so.0
  • #3 _gdk_x11_display_queue_events
    from /usr/lib/libgdk-3.so.0
  • #4 gdk_display_get_event
    from /usr/lib/libgdk-3.so.0
  • #5 gdk_event_source_dispatch
    from /usr/lib/libgdk-3.so.0
  • #6 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #7 ??
    from /usr/lib/libglib-2.0.so.0
  • #8 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #9 gtk_main
    from /usr/lib/libgtk-3.so.0
  • #10 main

About how I reproduce this bug, If I start the gtk application on my primary screen(DISPLAY=:0.0), everything is normal. If I start the gtk application on other screen(DISPLAY=:0.{1,2,3}), the application will run normally until I leave the textbox focused and select some text (on the same window or other windows). 

What else should I provide? I am glad to help you dight with this bug.
Comment 3 Bruce Guenter 2013-11-25 17:58:01 UTC
I can reproduce this bug as well, with similar condition. I most often see it when selecting text on any screen other than the crashing application.

I have captured a crash backtrace with gdb (while running gtk3-demo, many other programs are affected):

(gtk3-demo:24858): Gdk-CRITICAL **: gdk_x11_screen_lookup_visual: assertion 'GDK_IS_SCREEN (screen)' failed

Program received signal SIGSEGV, Segmentation fault.
gdk_x11_window_foreign_new_for_display (display=display@entry=0x732090, window=71472706) at gdkwindow-x11.c:1239
1239	  impl->window_scale = GDK_X11_SCREEN (screen)->window_scale;
(gdb) bt
  • #0 gdk_x11_window_foreign_new_for_display
    at gdkwindow-x11.c line 1239
  • #1 gdk_x11_display_translate_event
    at gdkdisplay-x11.c line 996
  • #2 _gdk_x11_event_translator_translate
    at gdkeventtranslator.c line 51
  • #3 gdk_event_source_translate_event
    at gdkeventsource.c line 240
  • #4 _gdk_x11_display_queue_events
    at gdkeventsource.c line 338
  • #5 gdk_display_get_event
    at gdkdisplay.c line 327
  • #6 gdk_event_source_dispatch
    at gdkeventsource.c line 360
  • #7 g_main_dispatch
    at gmain.c line 3065
  • #8 g_main_context_dispatch
    at gmain.c line 3641
  • #9 g_main_context_iterate
    at gmain.c line 3712
  • #10 g_main_loop_run
    at gmain.c line 3906
  • #11 gtk_main
    at gtkmain.c line 1158
  • #12 main
    at main.c line 948

Comment 4 Carlos Garnacho 2013-11-25 19:06:47 UTC
Seems to come down to 47a8c2f73302c88f8ef6daa08d3de625c18923d4, more specifically the changes to _gdk_x11_display_screen_for_xrootwin
Comment 5 farseerfc 2013-11-25 20:55:36 UTC
I saw this issue have been marked as fixed. First of all thank you for your fast fixing.

I tried to apply the commit 1d2a070254a2f01de3202392a8fdb43fc2ee84d2 manually to the source tree of 3.10.4 (which archlinux is using now), and the applications including gtk3-demo still crash.

I get this trace:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff74592d0 in gdk_property_change () from /usr/lib/libgdk-3.so.0
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7f8a8c0 (LWP 15540))

  • #0 gdk_property_change
    from /usr/lib/libgdk-3.so.0
  • #1 _gtk_selection_request
    from /usr/lib/libgtk-3.so.0
  • #2 _gtk_marshal_BOOLEAN__BOXEDv
    from /usr/lib/libgtk-3.so.0
  • #3 ??
    from /usr/lib/libgobject-2.0.so.0
  • #4 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #5 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #6 gtk_widget_event_internal
    from /usr/lib/libgtk-3.so.0
  • #7 gtk_main_do_event
    from /usr/lib/libgtk-3.so.0
  • #8 gdk_event_source_dispatch
    from /usr/lib/libgdk-3.so.0
  • #9 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #10 ??
    from /usr/lib/libglib-2.0.so.0
  • #11 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #12 gtk_main
    from /usr/lib/libgtk-3.so.0
  • #13 main

I don't know whether it is appropriate, but I suspect that the bug is still in somewhere.
Thank you for your attention.
Comment 6 Bruce Guenter 2013-11-25 22:28:05 UTC
I too backported the patch into openSUSE's gtk3 3.10.2 RPM and I can no longer reproduce the problem. The patch appears to have fixed the problem for me, so I suspect there are actually two separate bugs here.
Comment 7 Benjamin Otte (Company) 2013-11-26 00:10:34 UTC
From the trace it looks like it could happen when you copy from one screen and paste to the other screen. If so, could you open a new bug for that?
Comment 8 farseerfc 2013-11-26 00:33:13 UTC
I can reproduce the bug by exactly the same steps as previous. I run gtk3-demo in gdb on some screen(:0.2), selected some text in the "Info" text area, then gtk3-demo crashed. I didn't copy text from one screen to another, although the x11 selection could changed.

With gtk3-demo --gdk-debug=all enabled, I can get these messages before crash:

Gdk-Message: focus out:		window: 75497558, detail: NotifyAncestor, mode: NotifyNormal
Gdk-Message: property notify:	window: 75497558, atom(337): "_NET_WM_USER_TIME"

(gtk3-demo:26283): Gtk-CRITICAL **: gtk_tree_view_get_path_at_pos: assertion 'tree_view != NULL' failed

   18: interval=266.7 (sleep) layout_start=0.0  paint_start=0.2  frame_end=23.9 predicted=25.0
   19: interval=24.2         paint_start=0.0  frame_end=52.9 predicted=16.7
   20: interval=53.1         paint_start=0.0  frame_end=62.6 predicted=16.7
Gdk-Message: selection request:	window: 75498744

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff74592d0 in gdk_property_change () from /usr/lib/libgdk-3.so.0
(gdb) bt
  • #0 gdk_property_change
    from /usr/lib/libgdk-3.so.0
  • #1 _gtk_selection_request
    from /usr/lib/libgtk-3.so.0
  • #2 _gtk_marshal_BOOLEAN__BOXEDv
    from /usr/lib/libgtk-3.so.0
  • #3 ??
    from /usr/lib/libgobject-2.0.so.0
  • #4 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #5 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #6 gtk_widget_event_internal
    from /usr/lib/libgtk-3.so.0
  • #7 gtk_main_do_event
    from /usr/lib/libgtk-3.so.0
  • #8 gdk_event_source_dispatch
    from /usr/lib/libgdk-3.so.0
  • #9 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #10 ??
    from /usr/lib/libglib-2.0.so.0
  • #11 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #12 gtk_main
    from /usr/lib/libgtk-3.so.0
  • #13 main


Should I open another bug report in this circumstance?
Comment 9 Benjamin Otte (Company) 2013-11-26 00:34:57 UTC
I suppose you're running a clipboard manager or something like that?

And yes, please open a new bug.
Comment 10 farseerfc 2013-11-26 00:39:51 UTC
Turned out that it was my input method engine (fcitx) listening to the clipboard events. After I stopped fcitx, gtk3-demo no longer crashes. 

Thank you. I will open another bug.