X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/80c765ac5a07e835c9c20371d1ed9151762bfe41..0738b901b17340f09766524b8d9d79e9ed1268e7:/src/osx/cocoa/utils.mm diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 194abcd750..8d74b22883 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -52,9 +52,27 @@ void wxBell() void wxMacWakeUp() { - 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 // wxUSE_BASE @@ -148,9 +166,9 @@ void wxMacWakeUp() } @end -/* +/* allows ShowModal to work when using sheets. - see include/wx/osx/cocoa/private.h for more info + see include/wx/osx/cocoa/private.h for more info */ @implementation ModalDialogDelegate - (id)init @@ -161,7 +179,7 @@ void wxMacWakeUp() return self; } -- (BOOL)finished +- (BOOL)finished { return sheetFinished; } @@ -300,7 +318,7 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const // called from OnPaint, even with the window's paint dc as source (see wxHTMLWindow) NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect: [view bounds]] retain]; [view unlockFocus]; - + wxBitmap bitmap(width, height); if ( [rep respondsToSelector:@selector(CGImage)] ) { @@ -323,4 +341,4 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const #endif // wxUSE_GUI -#endif // wxOSX_USE_COCOA \ No newline at end of file +#endif // wxOSX_USE_COCOA