An auto-release pool is needed in this function because it can be called from
another thread which has no reason to have a pre-existing pool, but it does
allocate NSEvent object which is auto-released, resulting in warnings if no
pool available.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62310
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- NSEvent* wakeupEvent = [NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint
- modifierFlags:NSAnyEventMask timestamp:0 windowNumber:0 context:nil subtype:0 data1:0 data2:0];
- [NSApp postEvent:wakeupEvent atStart:NO];
+ // ensure that we have an auto release pool in place because the event will
+ // be autoreleased from NSEvent:otherEventWithType and we might not have a
+ // global pool during startup or shutdown and we actually never have it if
+ // we're called from another thread
+ //
+ // FIXME: we can't use wxMacAutoreleasePool here because it's in core and
+ // we're in base
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSEvent* wakeupEvent = [NSEvent otherEventWithType:NSApplicationDefined
+ location:NSZeroPoint
+ modifierFlags:NSAnyEventMask
+ timestamp:0
+ windowNumber:0
+ context:nil
+ subtype:0
+ data1:0
+ data2:0];
+ [NSApp postEvent:wakeupEvent atStart:NO];
+
+ [pool release];
-#endif // wxOSX_USE_COCOA
\ No newline at end of file
+#endif // wxOSX_USE_COCOA