Ver Fonte

sokol_app.h macos: wrap the view's draw method in an autoreleasepool, as recommended by the Metal docs

Andre Weissflog há 4 anos atrás
pai
commit
5fcfb868ed
1 ficheiros alterados com 6 adições e 2 exclusões
  1. 6 2
      sokol_app.h

+ 6 - 2
sokol_app.h

@@ -3368,7 +3368,9 @@ _SOKOL_PRIVATE void _sapp_macos_poll_input_events() {
     _SOKOL_UNUSED(rect);
     _SOKOL_UNUSED(rect);
     /* Catch any last-moment input events */
     /* Catch any last-moment input events */
     _sapp_macos_poll_input_events();
     _sapp_macos_poll_input_events();
-    _sapp_macos_frame();
+    @autoreleasepool {
+        _sapp_macos_frame();
+    }
     #if !defined(SOKOL_METAL)
     #if !defined(SOKOL_METAL)
     [[_sapp.macos.view openGLContext] flushBuffer];
     [[_sapp.macos.view openGLContext] flushBuffer];
     #endif
     #endif
@@ -3885,7 +3887,9 @@ _SOKOL_PRIVATE void _sapp_ios_show_keyboard(bool shown) {
 @implementation _sapp_ios_view
 @implementation _sapp_ios_view
 - (void)drawRect:(CGRect)rect {
 - (void)drawRect:(CGRect)rect {
     _SOKOL_UNUSED(rect);
     _SOKOL_UNUSED(rect);
-    _sapp_ios_frame();
+    @autoreleasepool {
+        _sapp_ios_frame();
+    }
 }
 }
 - (BOOL)isOpaque {
 - (BOOL)isOpaque {
     return YES;
     return YES;