Commit adbaee79 authored by Hugo Lefeuvre's avatar Hugo Lefeuvre Committed by Daniel Boles
Browse files

gtkstack: fix null pointer dereference

The gtk_stack_snapshot_slide() function dereferences the
last_visible_child pointer without proper != NULL ckeck. This might
result in NULL pointer dereference and crash if last_visible_child is
invalid.

Add a != NULL check before dereferencing the pointer.

cherry-picked from !361
parent b10cde7b
Pipeline #34420 passed with stage
in 7 minutes and 46 seconds
......@@ -2088,12 +2088,14 @@ gtk_stack_draw_slide (GtkWidget *widget,
x += priv->last_visible_surface_allocation.x;
y += priv->last_visible_surface_allocation.y;
if (priv->last_visible_child != NULL)
{
if (gtk_widget_get_valign (priv->last_visible_child->widget) == GTK_ALIGN_END &&
priv->last_visible_widget_height > allocation.height)
y -= priv->last_visible_widget_height - allocation.height;
else if (gtk_widget_get_valign (priv->last_visible_child->widget) == GTK_ALIGN_CENTER)
y -= (priv->last_visible_widget_height - allocation.height) / 2;
}
cairo_save (cr);
cairo_set_source_surface (cr, priv->last_visible_surface, x, y);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment