quartz: Fix crash when realizing GtkOffscreenWindow

GtkOffscreenWindow doesn't have a NSView or NSWindow, so return NULL if
passed one of those.

Closes: #379
This commit is contained in:
Philip Chimento 2017-05-21 20:40:40 -07:00
parent 00034c00be
commit df0e5cc8e6

View File

@ -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