Create an autorelease pool in glfwPostEmptyEvent.
This prevents leaking NSEvent objects.
Closes #372.
diff --git a/README.md b/README.md
index e2121c5..0cf76d7 100644
--- a/README.md
+++ b/README.md
@@ -251,6 +251,7 @@
- Ricardo Vieira
- Simon Voordouw
- Torsten Walluhn
+ - Patrick Walton
- Jay Weisskopf
- Frank Wille
- yuriks
diff --git a/src/cocoa_window.m b/src/cocoa_window.m
index 463c02c..dd7b012 100644
--- a/src/cocoa_window.m
+++ b/src/cocoa_window.m
@@ -1206,6 +1206,7 @@
void _glfwPlatformPostEmptyEvent(void)
{
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSEvent* event = [NSEvent otherEventWithType:NSApplicationDefined
location:NSMakePoint(0, 0)
modifierFlags:0
@@ -1216,6 +1217,7 @@
data1:0
data2:0];
[NSApp postEvent:event atStart:YES];
+ [pool drain];
}
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)