summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2023-03-03 08:44:29 -0500
committerEmmanuele Bassi <ebassi@gnome.org>2023-03-03 22:07:09 +0000
commit611788fb5305eff18d6e66eab800af304a84bfc7 (patch)
tree0f7f105183440ea856e1a37c44fb8c7e083c82fd
parent500128d186a7a3bb86ba9af8e5151e8335fe90da (diff)
downloadgtk+-611788fb5305eff18d6e66eab800af304a84bfc7.tar.gz
stack: Don't recreate at contexts in dispose
This is the same protection we have in GtkWidgetAccessible.
-rw-r--r--gtk/gtkstack.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 0975ecf472..59a3a0357b 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -219,6 +219,7 @@ struct _GtkStackPage
guint needs_attention : 1;
guint visible : 1;
guint use_underline : 1;
+ guint in_destruction : 1;
};
typedef struct _GtkStackPageClass GtkStackPageClass;
@@ -235,6 +236,14 @@ gtk_stack_page_accessible_get_at_context (GtkAccessible *accessible)
{
GtkStackPage *page = GTK_STACK_PAGE (accessible);
+ if (page->in_destruction)
+ {
+ GTK_DEBUG (A11Y, "ATContext for ā€œ%sā€ [%p] accessed during destruction",
+ G_OBJECT_TYPE_NAME (accessible),
+ accessible);
+ return NULL;
+ }
+
if (page->at_context == NULL)
{
GtkAccessibleRole role = GTK_ACCESSIBLE_ROLE_TAB_PANEL;
@@ -353,6 +362,8 @@ gtk_stack_page_dispose (GObject *object)
{
GtkStackPage *page = GTK_STACK_PAGE (object);
+ page->in_destruction = TRUE;
+
g_clear_object (&page->at_context);
G_OBJECT_CLASS (gtk_stack_page_parent_class)->dispose (object);