[gtk+/portal-race: 105/129] main: Protect against non-GtkWindow toplevels



commit dd17d3bfacdfe8c5aeffdce63532103cea9f9e68
Author: Timm Bäder <mail baedert org>
Date:   Mon Jun 26 12:00:20 2017 +0200

    main: Protect against non-GtkWindow toplevels

 gtk/gtkmain.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index e50a6d6..06a974a 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1471,6 +1471,7 @@ handle_pointing_event (GdkEvent *event)
 {
   GtkWidget *target = NULL, *old_target = NULL, *widget;
   GtkWindow *toplevel;
+  GtkWidget *toplevel_widget;
   GdkEventSequence *sequence;
   GdkDevice *device;
   gdouble x, y;
@@ -1480,10 +1481,12 @@ handle_pointing_event (GdkEvent *event)
   if (!device || !gdk_event_get_coords (event, &x, &y))
     return widget;
 
-  toplevel = GTK_WINDOW (gtk_widget_get_toplevel (widget));
-  if (!GTK_IS_WINDOW (toplevel))
+  toplevel_widget = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel_widget))
     return widget;
 
+  toplevel = GTK_WINDOW (toplevel_widget);
+
   sequence = gdk_event_get_event_sequence (event);
 
   switch (event->type)


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