[gtk/matthiasc/for-master] Check for root being a GtkWindow in a few places




commit 32280090fe40bd9423be945fa1e03de95c5cb8a2
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 30 13:44:15 2021 -0400

    Check for root being a GtkWindow in a few places
    
    These things were showing up as crashes during DND,
    when the root is a GtkDragIcon. I'm sure there's more.

 gtk/gtkwidget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b141179450..d4b6ad5191 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7826,7 +7826,7 @@ _gtk_widget_list_devices (GtkWidget *widget,
     }
 
   root = gtk_widget_get_root (widget);
-  if (!root)
+  if (!GTK_IS_WINDOW (root))
     {
       *out_n_devices = 0;
       return NULL;
@@ -12162,7 +12162,7 @@ gtk_widget_set_cursor (GtkWidget *widget,
     return;
 
   root = _gtk_widget_get_root (widget);
-  if (root)
+  if (GTK_IS_WINDOW (root))
     gtk_window_maybe_update_cursor (GTK_WINDOW (root), widget, NULL);
 
   g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CURSOR]);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]