[gtk/ebassi/issue-4421] Unrealize ATContext on unroot
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/issue-4421] Unrealize ATContext on unroot
- Date: Mon, 8 Nov 2021 10:20:52 +0000 (UTC)
commit 018388d32116b2600ecdf9a7bd5cbbb6873b8818
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Nov 8 10:14:48 2021 +0000
Unrealize ATContext on unroot
Non-root widgets should unrealize their ATContext, if they have one,
when they are unrooted, as they don't have a connection to a top level
any more.
Fixes: #4421
gtk/gtkwidget.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 907e2004f2..b0921818a8 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2441,6 +2441,18 @@ gtk_widget_root_at_context (GtkWidget *self)
gtk_at_context_set_display (priv->at_context, gtk_root_get_display (priv->root));
}
+static void
+gtk_widget_unroot_at_context (GtkWidget *self)
+{
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (self);
+
+ if (priv->at_context != NULL)
+ {
+ gtk_at_context_set_display (priv->at_context, gdk_display_get_default ());
+ gtk_at_context_unrealize (priv->at_context);
+ }
+}
+
void
gtk_widget_realize_at_context (GtkWidget *self)
{
@@ -2532,6 +2544,9 @@ gtk_widget_unroot (GtkWidget *widget)
if (!GTK_IS_ROOT (widget))
{
+ /* Roots unrealize the ATContext on unmap */
+ gtk_widget_unroot_at_context (widget);
+
priv->root = NULL;
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_ROOT]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]