Focusing an entry in a popover via a touch event causes segfault
Basically most of the time you use a touchscreen or touch emulation and focus an (empty) Gtk Entry, that is inside a Gtk Popover you get a segfault.
To reproduce:
- Use a touchscreen or enable the Gtk inspector
- Open a gtk application, that has a Gtk Entry inside a popover (That includes the popover demo, gnome-calendar or anything with an emoji chooser)
- Turn on touch emulation, if you are not using a touchscreen
- Open a popover with a Gtk Entry
- If the entry autofocused tap/click on another widget* in the popover to unfocus it
- Tap/Click on the entry to focus it
- => Segfault
*for some reason it does not crash when this other widget is a Gtk TextView (automatically switching the focus using the grab_focus() signal will not prevent it from crashing)
I have originally noticed this on a pinephone running a community build of the (debian based) pureOS and managed to reproduce it on a machine running an up to date manjaro with Gtk 3.24.20
Below are the last word of gnome-calendar, the gtk3 popover demo and the gtk widget factory:
Gnome Calendar crashed with the entry in the New Event popover
(gnome-calendar:131412): Gtk-CRITICAL **: 14:34:31.375: _gtk_widget_get_preferred_size_and_baseline: assertion 'GTK_IS_WIDGET (widget)' failed
[1] 131412 segmentation fault (core dumped) gnome-calendar
Gnome Calendar when tapping on the entry in the main menu under "Weather"
[1] 482735 segmentation fault (core dumped) gnome-calendar
gtk3-demo crashed using the popover demo (also works, when using the demo from the gtk-3-24 branch)
(gtk3-demo:133126): Gtk-CRITICAL **: 15:03:08.290: _gtk_widget_get_preferred_size_and_baseline: assertion 'GTK_IS_WIDGET (widget)' failed
(gtk3-demo:133126): Gtk-CRITICAL **: 15:03:08.291: gtk_widget_get_vexpand: assertion 'GTK_IS_WIDGET (widget)' failed
(gtk3-demo:133126): Gtk-CRITICAL **: 15:03:08.291: gtk_widget_get_direction: assertion 'GTK_IS_WIDGET (widget)' failed
[1] 133126 segmentation fault (core dumped) gtk3-demo
The gtkwidget factory using the emoji picker on the third page
(gtk3-widget-factory:482326): Gtk-CRITICAL **: 17:02:21.567: _gtk_widget_get_preferred_size_and_baseline: assertion 'GTK_IS_WIDGET (widget)' failed
(gtk3-widget-factory:482326): Gtk-CRITICAL **: 17:02:21.567: gtk_widget_get_vexpand: assertion 'GTK_IS_WIDGET (widget)' failed
(gtk3-widget-factory:482326): Gtk-CRITICAL **: 17:02:21.567: gtk_widget_get_direction: assertion 'GTK_IS_WIDGET (widget)' failed
(gtk3-widget-factory:482326): Gtk-CRITICAL **: 17:02:21.567: gtk_widget_get_hexpand: assertion 'GTK_IS_WIDGET (widget)' failed
[1] 482326 segmentation fault (core dumped) gtk3-widget-factory
A backtrace of the gtk3-demo (popover demo) built from the gtk-3-24 branch: backtrace.txt