diff --git a/src/SFML/Window/Cocoa/AppController.mm b/src/SFML/Window/Cocoa/AppController.mm index 1e0696612..93560906d 100644 --- a/src/SFML/Window/Cocoa/AppController.mm +++ b/src/SFML/Window/Cocoa/AppController.mm @@ -380,14 +380,14 @@ myOwningEventLoop = YES; } - // Clean the autorelease pool - [myMainPool release]; - myMainPool = [[NSAutoreleasePool alloc] init]; - NSEvent *event = nil; if (myOwningEventLoop) { + // Clean the autorelease pool + [myMainPool release]; + myMainPool = [[NSAutoreleasePool alloc] init]; + // Minimal event loop while (nil != (event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil