Check if childs actually exists before using it

Check seems to have gone lost during GtkBin sealing in commit 4427760b

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=624707
This commit is contained in:
Javier Jardón 2010-07-22 16:43:23 +02:00
parent 90db251624
commit c1a2ecc369
4 changed files with 16 additions and 8 deletions

View File

@ -378,7 +378,8 @@ gtk_handle_box_map (GtkWidget *widget)
gtk_widget_set_mapped (widget, TRUE);
child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child) &&
if (child != NULL &&
gtk_widget_get_visible (child) &&
!gtk_widget_get_mapped (child))
gtk_widget_map (child);
@ -652,7 +653,7 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
widget->allocation.height);
if (gtk_widget_get_visible (child))
if (child != NULL && gtk_widget_get_visible (child))
{
GtkAllocation child_allocation;
guint border_width;
@ -919,6 +920,7 @@ gtk_handle_box_paint (GtkWidget *widget,
GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
GtkHandleBoxPriv *priv = hb->priv;
GtkBin *bin = GTK_BIN (widget);
GtkWidget *child;
gint width, height;
GdkRectangle rect;
GdkRectangle dest;
@ -993,7 +995,8 @@ gtk_handle_box_paint (GtkWidget *widget,
event ? &event->area : area,
handle_orientation);
if (gtk_widget_get_visible (gtk_bin_get_child (bin)))
child = gtk_bin_get_child (bin);
if (child != NULL && gtk_widget_get_visible (child))
GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->expose_event (widget, event);
}

View File

@ -973,7 +973,8 @@ gtk_menu_item_size_request (GtkWidget *widget,
requisition->height += 2 * horizontal_padding;
child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child))
if (child != NULL && gtk_widget_get_visible (child))
{
GtkRequisition child_requisition;

View File

@ -64,7 +64,8 @@ gtk_offscreen_window_size_request (GtkWidget *widget,
requisition->height = border_width * 2;
child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child))
if (child != NULL && gtk_widget_get_visible (child))
{
GtkRequisition child_req;
@ -103,7 +104,8 @@ gtk_offscreen_window_size_allocate (GtkWidget *widget,
allocation->height);
child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child))
if (child != NULL && gtk_widget_get_visible (child))
{
GtkAllocation child_alloc;

View File

@ -710,7 +710,8 @@ gtk_plug_map (GtkWidget *widget)
gtk_widget_set_mapped (widget, TRUE);
child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child) &&
if (child != NULL &&
gtk_widget_get_visible (child) &&
!gtk_widget_get_mapped (child))
gtk_widget_map (child);
@ -765,7 +766,8 @@ gtk_plug_size_allocate (GtkWidget *widget,
allocation->width, allocation->height);
child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child))
if (child != NULL && gtk_widget_get_visible (child))
{
GtkAllocation child_allocation;