Merge branch 'fallback-menu-critical' into 'master'

popovermenu: Avoid a critical

Closes #2998

See merge request GNOME/gtk!2343
This commit is contained in:
Matthias Clasen 2020-08-02 17:42:22 +00:00
commit 638ea2d6fc

View File

@ -228,7 +228,14 @@ static void
focus_out (GtkEventController *controller,
GtkPopoverMenu *menu)
{
GtkWidget *new_focus = gtk_root_get_focus (gtk_widget_get_root (GTK_WIDGET (menu)));
GtkRoot *root;
GtkWidget *new_focus;
root = gtk_widget_get_root (GTK_WIDGET (menu));
if (!root)
return;
new_focus = gtk_root_get_focus (root);
if (!gtk_event_controller_focus_contains_focus (GTK_EVENT_CONTROLLER_FOCUS (controller)) &&
new_focus != NULL)