From 05249dc19133b27a483a1d363b11b9ebc57412d6 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 3 Nov 2015 16:14:05 -0300 Subject: [PATCH] Fix crash closing the window when it's on fullscreen mode on OS X --- src/allegro/src/macosx/system.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/allegro/src/macosx/system.m b/src/allegro/src/macosx/system.m index df50d2a77..f2c41d25f 100644 --- a/src/allegro/src/macosx/system.m +++ b/src/allegro/src/macosx/system.m @@ -198,11 +198,15 @@ void osx_event_handler() int event_type; BOOL gotmouseevent = NO; - while ((event = [NSApp nextEventMatchingMask: NSAnyEventMask - untilDate: [NSDate distantPast] - inMode: NSDefaultRunLoopMode - dequeue: YES])) + while (osx_window != nil) { + event = [NSApp nextEventMatchingMask: NSAnyEventMask + untilDate: [NSDate distantPast] + inMode: NSDefaultRunLoopMode + dequeue: YES]; + if (!event) + return; + BOOL send_event = YES; _unix_lock_mutex(osx_skip_events_processing_mutex);