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,16 +3137,15 @@ gtk_widget_real_show (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (!_gtk_widget_get_visible (widget))
{
priv->visible = TRUE;
g_return_if_fail (!_gtk_widget_get_visible (widget));
if (priv->parent &&
_gtk_widget_get_mapped (priv->parent) &&
_gtk_widget_get_child_visible (widget) &&
!_gtk_widget_get_mapped (widget))
gtk_widget_map (widget);
}
priv->visible = TRUE;
if (priv->parent &&
_gtk_widget_get_mapped (priv->parent) &&
_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))
{
priv->visible = FALSE;
g_return_if_fail (_gtk_widget_get_visible (widget));
if (_gtk_widget_get_mapped (widget))
gtk_widget_unmap (widget);
}
priv->visible = FALSE;
if (_gtk_widget_get_mapped (widget))
gtk_widget_unmap (widget);
}
static void