diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-11-25 07:59:35 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-11-25 08:12:39 -0500 |
commit | b4e10b6bc36bbd8bfb33bc6b74e8d3b1d3d75a9e (patch) | |
tree | 640615c09467e59bb35aa486d3ca1ca878a88f49 | |
parent | e73f0f69748b94a23102472b69e0ca194923a24d (diff) | |
download | gtk+-keyboard-dir-crash.tar.gz |
text: Prevent unexpected notify::direction emissionskeyboard-dir-crash
Calling gdk_device_get_direction can trigger a
notify::direction emissions, since the X11 backend
determines the direction on demand. Prevent that by
forcing the direction to be determined ahead of time.
Fixes: #5311
-rw-r--r-- | gtk/gtktext.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 89dda9782f..a8c21e2fd1 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -3237,8 +3237,12 @@ gtk_text_focus_changed (GtkEventControllerFocus *controller, if (gtk_event_controller_focus_is_focus (controller)) { if (keyboard) - g_signal_connect (keyboard, "notify::direction", - G_CALLBACK (direction_changed), self); + { + /* Work around unexpected notify::direction emissions */ + gdk_device_get_direction (keyboard); + g_signal_connect (keyboard, "notify::direction", + G_CALLBACK (direction_changed), self); + } gtk_text_im_set_focus_in (self); gtk_text_reset_blink_time (self); |