Merge branch 'ebassi/atcontext-dispose' into 'main'

a11y: Clear the accessible tree in GtkATContext

See merge request GNOME/gtk!5587
This commit is contained in:
Matthias Clasen 2023-03-03 01:54:38 +00:00
commit 5fe32a46a0
2 changed files with 8 additions and 6 deletions

View File

@ -85,6 +85,9 @@ gtk_at_context_dispose (GObject *gobject)
gtk_at_context_unrealize (self); gtk_at_context_unrealize (self);
g_clear_object (&self->accessible_parent);
g_clear_object (&self->next_accessible_sibling);
G_OBJECT_CLASS (gtk_at_context_parent_class)->dispose (gobject); G_OBJECT_CLASS (gtk_at_context_parent_class)->dispose (gobject);
} }
@ -459,14 +462,14 @@ GtkAccessible *
gtk_at_context_get_accessible_parent (GtkATContext *self) gtk_at_context_get_accessible_parent (GtkATContext *self)
{ {
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL); g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
return self->accessible_parent; return self->accessible_parent;
} }
/*< private > /*< private >
* gtk_at_context_set_accessible_parent: * gtk_at_context_set_accessible_parent:
* @self: a `GtkAtContext` * @self: a `GtkAtContext`
* @parent: the parent `GtkAccessible` to set * @parent: (nullable): the parent `GtkAccessible` to set
* *
* Sets the parent accessible object of the given `GtkAtContext`. * Sets the parent accessible object of the given `GtkAtContext`.
*/ */
@ -475,7 +478,7 @@ gtk_at_context_set_accessible_parent (GtkATContext *self,
GtkAccessible *parent) GtkAccessible *parent)
{ {
g_return_if_fail (GTK_IS_AT_CONTEXT (self)); g_return_if_fail (GTK_IS_AT_CONTEXT (self));
g_set_object (&self->accessible_parent, parent); g_set_object (&self->accessible_parent, parent);
} }
@ -491,7 +494,7 @@ GtkAccessible *
gtk_at_context_get_next_accessible_sibling (GtkATContext *self) gtk_at_context_get_next_accessible_sibling (GtkATContext *self)
{ {
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL); g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
return self->next_accessible_sibling; return self->next_accessible_sibling;
} }
@ -507,7 +510,7 @@ gtk_at_context_set_next_accessible_sibling (GtkATContext *self,
GtkAccessible *sibling) GtkAccessible *sibling)
{ {
g_return_if_fail (GTK_IS_AT_CONTEXT (self)); g_return_if_fail (GTK_IS_AT_CONTEXT (self));
g_set_object (&self->next_accessible_sibling, sibling); g_set_object (&self->next_accessible_sibling, sibling);
} }

View File

@ -1726,7 +1726,6 @@ stack_remove (GtkStack *stack,
if (priv->last_visible_child == child_info) if (priv->last_visible_child == child_info)
priv->last_visible_child = NULL; priv->last_visible_child = NULL;
gtk_accessible_set_accessible_parent (GTK_ACCESSIBLE (child), NULL, NULL);
gtk_widget_unparent (child); gtk_widget_unparent (child);
g_clear_object (&child_info->widget); g_clear_object (&child_info->widget);