Преглед на файлове

Create an autorelease pool in glfwPostEmptyEvent.

This prevents leaking NSEvent objects.

Closes #372.
Patrick Walton преди 11 години
родител
ревизия
5052b2d7e0
променени са 2 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 1 0
      README.md
  2. 2 0
      src/cocoa_window.m

+ 1 - 0
README.md

@@ -251,6 +251,7 @@ skills.
  - Ricardo Vieira
  - Ricardo Vieira
  - Simon Voordouw
  - Simon Voordouw
  - Torsten Walluhn
  - Torsten Walluhn
+ - Patrick Walton
  - Jay Weisskopf
  - Jay Weisskopf
  - Frank Wille
  - Frank Wille
  - yuriks
  - yuriks

+ 2 - 0
src/cocoa_window.m

@@ -1206,6 +1206,7 @@ void _glfwPlatformWaitEvents(void)
 
 
 void _glfwPlatformPostEmptyEvent(void)
 void _glfwPlatformPostEmptyEvent(void)
 {
 {
+    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
     NSEvent* event = [NSEvent otherEventWithType:NSApplicationDefined
     NSEvent* event = [NSEvent otherEventWithType:NSApplicationDefined
                                         location:NSMakePoint(0, 0)
                                         location:NSMakePoint(0, 0)
                                    modifierFlags:0
                                    modifierFlags:0
@@ -1216,6 +1217,7 @@ void _glfwPlatformPostEmptyEvent(void)
                                            data1:0
                                            data1:0
                                            data2:0];
                                            data2:0];
     [NSApp postEvent:event atStart:YES];
     [NSApp postEvent:event atStart:YES];
+    [pool drain];
 }
 }
 
 
 void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
 void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)