mirror of
https://github.com/glfw/glfw.git
synced 2025-10-03 13:20:58 +00:00
Create an autorelease pool on Mac OS X when using glfwPostEmptyEvent
from another thread. This avoids leaks of the `NSEvent` objects.
This commit is contained in:
parent
a21f2377bc
commit
962951344d
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user