gtkwidget: Do a type-check in gtk_widget_in_destruction()

Given it can be called during a widget destruction, it's safer to do a
type-check before crashing.

See: https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1727
This commit is contained in:
Marco Trevisan (Treviño) 2023-03-24 03:29:53 +01:00
parent 634bea777f
commit 07197a299f

View File

@ -10638,7 +10638,11 @@ gtk_widget_set_has_focus (GtkWidget *widget,
gboolean
gtk_widget_in_destruction (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GtkWidgetPrivate *priv;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
priv = gtk_widget_get_instance_private (widget);
return priv->in_destruction;
}