widget: Insist on proper vfunc calling

Insist that ->show() is only called for invisible and ->hide only for
visible widgets.
This commit is contained in:
Benjamin Otte 2019-05-29 15:01:18 +02:00
parent a079fd2def
commit e85f1e176a

View File

@ -3137,8 +3137,8 @@ gtk_widget_real_show (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (!_gtk_widget_get_visible (widget))
{
g_return_if_fail (!_gtk_widget_get_visible (widget));
priv->visible = TRUE;
if (priv->parent &&
@ -3146,7 +3146,6 @@ gtk_widget_real_show (GtkWidget *widget)
_gtk_widget_get_child_visible (widget) &&
!_gtk_widget_get_mapped (widget))
gtk_widget_map (widget);
}
}
/**
@ -3204,13 +3203,12 @@ gtk_widget_real_hide (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (_gtk_widget_get_visible (widget))
{
g_return_if_fail (_gtk_widget_get_visible (widget));
priv->visible = FALSE;
if (_gtk_widget_get_mapped (widget))
gtk_widget_unmap (widget);
}
}
static void