--- GdkQuartzWindow.c.orig 2016-02-20 13:09:16.290642581 -0500 +++ GdkQuartzWindow.c 2016-02-20 13:10:39.886709040 -0500 @@ -24,6 +24,14 @@ @implementation GdkQuartzWindow +- (void)windowWillClose:(NSNotification*)notification +{ + // Clears the delegate when window is going to be closed; since EL + // Capitan it is possible that the methods of delegate would get + // called after the window has been closed. + [self setDelegate:nil]; +} + -(BOOL)windowShouldClose:(id)sender { GdkWindow *window = [[self contentView] gdkWindow]; --- GdkQuartzView.c.orig 2016-02-20 13:09:26.641403172 -0500 +++ GdkQuartzView.c 2016-02-20 13:12:45.434805163 -0500 @@ -684,7 +684,7 @@ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl); NSRect rect; - if (!impl->toplevel) + if (!impl || !impl->toplevel) return; if (trackingRect)