Codechange: [OSX] Drain autoreleased objects in each game loop cycle.

pull/221/head
Michael Lutz 4 years ago
parent 8aaf4ea098
commit 60f30036f1

@ -203,6 +203,7 @@ bool CocoaSetupApplication()
}
/* Become the front process, important when start from the command line. */
[ [ NSApplication sharedApplication ] setActivationPolicy:NSApplicationActivationPolicyRegular ];
[ [ NSApplication sharedApplication ] activateIgnoringOtherApps:YES ];
/* Set up the menubar */
@ -247,6 +248,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
return;
}
@autoreleasepool {
NSAlert *alert = [ [ NSAlert alloc ] init ];
[ alert setAlertStyle: NSCriticalAlertStyle ];
[ alert setMessageText:[ NSString stringWithUTF8String:title ] ];
@ -254,8 +256,9 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
[ alert addButtonWithTitle: [ NSString stringWithUTF8String:buttonLabel ] ];
[ alert runModal ];
[ alert release ];
}
if (!wasstarted && VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop();
if (!wasstarted && VideoDriver::GetInstance() != nullptr) VideoDriver::GetInstance()->Stop();
_cocoa_video_dialog = false;
}

@ -609,6 +609,8 @@ void VideoDriver_Cocoa::GameLoop()
this->Draw(true);
for (;;) {
@autoreleasepool {
uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
InteractiveRandom(); // randomness
@ -662,6 +664,7 @@ void VideoDriver_Cocoa::GameLoop()
this->Draw();
}
}
}
#ifdef _DEBUG
uint32 et = GetTick();

Loading…
Cancel
Save