From df0e5cc8e67ac012bce366d04cca8e5b5266f64e Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sun, 21 May 2017 20:40:40 -0700 Subject: [PATCH] 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