Bug 176154

Summary: [GTK][Wayland] Crash when gdk_keymap_get_entries_for_keyval returns TRUE but n_keys=0
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, clopez
Priority: P2 Keywords: Gtk
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugzilla.gnome.org/show_bug.cgi?id=787069
Attachments:
Description Flags
Patch
none
Patch clopez: review+

Description Carlos Garcia Campos 2017-08-31 02:43:54 PDT
I think this is actually a GTK+ bug (I'll file a bug report), but in Wayland gdk_keymap_get_entries_for_keyval() can return TRUE with n_keys=0. We have several places in WebKit where we just check the return value of gdk_keymap_get_entries_for_keyval() and then use the returned array to get the first position assuming it has at least one item. This has always worked in X11 because the GDK X11 backend does the right thing, but it's crashing in Wayland now. It should be fixed in GTK+ but in the meantime it's easy to workaround by also checking n_keys > 0.
Comment 1 Carlos Garcia Campos 2017-08-31 02:47:51 PDT
Created attachment 319454 [details]
Patch
Comment 2 Carlos Garcia Campos 2017-08-31 02:55:24 PDT
Created attachment 319455 [details]
Patch
Comment 3 Carlos Garcia Campos 2017-08-31 07:07:23 PDT
Committed r221419: <http://trac.webkit.org/changeset/221419>