mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-21 00:31:50 +00:00
fix SDL leak by wrapping video_refresh() call with an NSAutoReleasePool
This commit is contained in:
parent
cb0d1a818d
commit
45fbd1523f
@ -346,7 +346,13 @@ static void CustomApplicationMain (int argc, char **argv)
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// This is used from video_sdl.cpp.
|
||||
void NSAutoReleasePool_wrap(void (*fn)(void))
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
fn();
|
||||
[pool release];
|
||||
}
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
|
@ -66,6 +66,11 @@
|
||||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
#if (defined(__APPLE__) && defined(__MACH__))
|
||||
extern "C" {
|
||||
void NSAutoReleasePool_wrap(void (*fn)(void));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Supported video modes
|
||||
using std::vector;
|
||||
@ -2237,7 +2242,12 @@ static inline void do_video_refresh(void)
|
||||
handle_events();
|
||||
|
||||
// Update display
|
||||
#if (defined(__APPLE__) && defined(__MACH__))
|
||||
// SDL expects an auto-release pool to be present.
|
||||
NSAutoReleasePool_wrap(video_refresh);
|
||||
#else
|
||||
video_refresh();
|
||||
#endif
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
// Set new cursor image if it was changed
|
||||
|
Loading…
x
Reference in New Issue
Block a user