[gtk/matthiasc/for-master: 64/64] tooltip: Never set a window to be its own parent
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 64/64] tooltip: Never set a window to be its own parent
- Date: Mon, 30 Dec 2019 14:54:29 +0000 (UTC)
commit 772ac2b0c587b9bd0927d339550341a547b70057
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Dec 30 09:52:13 2019 -0500
tooltip: Never set a window to be its own parent
We do get events on the tooltip window too, and
we better ignore them, or bad things may happen,
such as widgets that are their own parents and
cause infinite loops.
Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2339
gtk/gtktooltip.c | 3 +++
gtk/gtktooltipwindow.c | 2 ++
2 files changed, 5 insertions(+)
---
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 88cf89651d..1112e6a374 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -495,6 +495,9 @@ gtk_tooltip_set_surface (GtkTooltip *tooltip,
if (tooltip->native == native)
return;
+ if (GTK_IS_TOOLTIP_WINDOW (native))
+ return;
+
if (tooltip->native)
g_object_weak_unref (G_OBJECT (tooltip->native), native_weak_notify, tooltip);
diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c
index 28e63d095f..2467657889 100644
--- a/gtk/gtktooltipwindow.c
+++ b/gtk/gtktooltipwindow.c
@@ -558,6 +558,8 @@ void
gtk_tooltip_window_set_relative_to (GtkTooltipWindow *window,
GtkWidget *relative_to)
{
+ g_return_if_fail (GTK_WIDGET (window) != relative_to);
+
if (window->relative_to == relative_to)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]