Bug 176154 - [GTK][Wayland] Crash when gdk_keymap_get_entries_for_keyval returns TRUE but n_keys=0
Summary: [GTK][Wayland] Crash when gdk_keymap_get_entries_for_keyval returns TRUE but ...
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: Gtk
Depends on:
Reported: 2017-08-31 02:43 PDT by Carlos Garcia Campos
Modified: 2017-08-31 07:07 PDT (History)
2 users (show)

See Also:

Patch (8.92 KB, patch)
2017-08-31 02:47 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Patch (8.92 KB, patch)
2017-08-31 02:55 PDT, Carlos Garcia Campos
clopez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
Comment 2 Carlos Garcia Campos 2017-08-31 02:55:24 PDT
Created attachment 319455 [details]
Comment 3 Carlos Garcia Campos 2017-08-31 07:07:23 PDT
Committed r221419: <http://trac.webkit.org/changeset/221419>