[gtk/gtk-3-24: 1/2] quartz: Fix crash when realizing GtkOffscreenWindow



commit df0e5cc8e67ac012bce366d04cca8e5b5266f64e
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun May 21 20:40:40 2017 -0700

    quartz: Fix crash when realizing GtkOffscreenWindow
    
    GtkOffscreenWindow doesn't have a NSView or NSWindow, so return NULL if
    passed one of those.
    
    Closes: #379

 gtk/gtkdnd-quartz.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index f9d70e455c..d92933a0e8 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -36,6 +36,7 @@
 #include "gtkimageprivate.h"
 #include "gtkinvisible.h"
 #include "gtkmain.h"
+#include "gtkoffscreenwindow.h"
 #include "deprecated/gtkstock.h"
 #include "gtkwindow.h"
 #include "gtkintl.h"
@@ -354,7 +355,11 @@ get_toplevel_nswindow (GtkWidget *widget)
 {
   GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
   GdkWindow *window = gtk_widget_get_window (toplevel);
-  
+
+  /* Offscreen windows don't support drag and drop */
+  if (GTK_IS_OFFSCREEN_WINDOW (toplevel))
+    return NULL;
+
   if (gtk_widget_is_toplevel (toplevel) && window)
     return [gdk_quartz_window_get_nsview (window) window];
   else


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