summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-04-28 23:44:20 +0200
committerBastien Nocera <hadess@hadess.net>2021-04-28 23:44:20 +0200
commit44aa328dc3bf94a6075ca36fc39748e7cae41c9e (patch)
tree948993413e653c2c63511639ad9fb37ed2d55162
parente024a542b0e669cc9088edd88a098abc7e1fe5aa (diff)
downloadgtk+-44aa328dc3bf94a6075ca36fc39748e7cae41c9e.tar.gz
box: Fix guards not workingwip/hadess/box-guards
The guards weren't working because we were accessing data inside the arguments before checking them. Postpone data access until after the guards. 0x00007ffff741203c in gtk_box_pack (box=box@entry=0x0, child=0xe0b1b0, expand=expand@entry=0, fill=fill@entry=0, padding=padding@entry=0, pack_type=pack_type@entry=GTK_PACK_START) at /usr/src/debug/gtk3-3.24.28-2.fc34.x86_64/gtk/gtkbox.c:1530 1530 GtkBoxPrivate *private = box->priv; (gdb) bt #0 0x00007ffff741203c in gtk_box_pack (box=box@entry=0x0, child=0xe0b1b0, expand=expand@entry=0, fill=fill@entry=0, padding=padding@entry=0, pack_type=pack_type@entry=GTK_PACK_START) at /usr/src/debug/gtk3-3.24.28-2.fc34.x86_64/gtk/gtkbox.c:1530 #1 0x00007ffff741223c in gtk_box_pack_start (box=box@entry=0x0, child=<optimized out>, expand=expand@entry=0, fill=fill@entry=0, padding=padding@entry=0) at /usr/src/debug/gtk3-3.24.28-2.fc34.x86_64/gtk/gtkbox.c:2179
-rw-r--r--gtk/gtkbox.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 3c4534a092..c372f9c714 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -1526,14 +1526,17 @@ gtk_box_pack (GtkBox *box,
guint padding,
GtkPackType pack_type)
{
- GtkContainer *container = GTK_CONTAINER (box);
- GtkBoxPrivate *private = box->priv;
+ GtkContainer *container;
+ GtkBoxPrivate *private;
GtkBoxChild *child_info;
g_return_val_if_fail (GTK_IS_BOX (box), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (child), NULL);
g_return_val_if_fail (_gtk_widget_get_parent (child) == NULL, NULL);
+ container = GTK_CONTAINER (box);
+ private = box->priv;
+
child_info = g_new (GtkBoxChild, 1);
child_info->widget = child;
child_info->padding = padding;