[gtk/ebassi/childless-stack-page] stack: Assert that StackPage:child is set
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/childless-stack-page] stack: Assert that StackPage:child is set
- Date: Mon, 29 Nov 2021 16:58:33 +0000 (UTC)
commit 03db2dc11883dac8aeb4aecdaf20cd1d43aa95ab
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Nov 29 16:57:21 2021 +0000
stack: Assert that StackPage:child is set
Childless GtkStackPage instances are not allowed, otherwise everything
falls apart in random places.
gtk/gtkstack.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index facf7ca3eb..1c272b9a34 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -395,6 +395,17 @@ gtk_stack_page_set_property (GObject *object,
break;
}
}
+
+static void
+gtk_stack_page_constructed (GObject *gobject)
+{
+ GtkStackPage *self = GTK_STACK_PAGE (gobject);
+
+ g_assert (self->widget != NULL);
+
+ G_OBJECT_CLASS (gtk_stack_page_parent_class)->constructed (gobject);
+}
+
static void
gtk_stack_page_class_init (GtkStackPageClass *class)
{
@@ -404,6 +415,7 @@ gtk_stack_page_class_init (GtkStackPageClass *class)
object_class->dispose = gtk_stack_page_dispose;
object_class->get_property = gtk_stack_page_get_property;
object_class->set_property = gtk_stack_page_set_property;
+ object_class->constructed = gtk_stack_page_constructed;
/**
* GtkStackPage:child: (attributes org.gtk.Property.get=gtk_stack_page_get_child)
@@ -2583,7 +2595,7 @@ gtk_stack_measure (GtkWidget *widget,
int min_for_size;
gtk_widget_measure (child, OPPOSITE_ORIENTATION (orientation), -1, &min_for_size, NULL, NULL,
NULL);
-
+
gtk_widget_measure (child, orientation, MAX (min_for_size, for_size), &child_min, &child_nat,
NULL, NULL);
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]