diff options
author | Kevin Walzer <kw@codebykevin.com> | 2015-12-07 02:02:44 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2015-12-07 02:02:44 (GMT) |
commit | 6aad9c9b454d5334c3e36cd2bf623dae8369defe (patch) | |
tree | 740de6d2fe3af13e22213ec4ef7e027a3d1d93ee /macosx/tkMacOSXDraw.c | |
parent | 3c354d91432f5a951efb12e957299cacdeafb897 (diff) | |
download | tk-6aad9c9b454d5334c3e36cd2bf623dae8369defe.zip tk-6aad9c9b454d5334c3e36cd2bf623dae8369defe.tar.gz tk-6aad9c9b454d5334c3e36cd2bf623dae8369defe.tar.bz2 |
Fix for zombie windows on El Capitan/OS X 10.11; thanks to Marc Culler for patch
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r-- | macosx/tkMacOSXDraw.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index ed8c428..bcc7afe 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -138,6 +138,7 @@ BitmapRepFromDrawableRect( CGImageRef cg_image=NULL, sub_cg_image=NULL; NSBitmapImageRep *bitmap_rep=NULL; NSView *view=NULL; + NSAutoreleasePool *pool = [NSAutoreleasePool new]; if ( mac_drawable->flags & TK_IS_PIXMAP ) { /* This means that the MacDrawable is functioning as a Tk Pixmap, so its view @@ -174,6 +175,7 @@ BitmapRepFromDrawableRect( } else { TkMacOSXDbgMsg("Invalid source drawable"); } + [pool drain]; return bitmap_rep; } @@ -1568,7 +1570,6 @@ TkScrollWindow( /* Belt and suspenders: make the AppKit request a redraw when it gets control again. */ - [view setNeedsDisplay:YES]; } } else { dmgRgn = HIShapeCreateEmpty(); @@ -1635,6 +1636,7 @@ TkMacOSXSetupDrawingContext( int dontDraw = 0, isWin = 0; TkMacOSXDrawingContext dc = {}; CGRect clipBounds; + NSAutoreleasePool *pool = [NSAutoreleasePool new]; dc.clipRgn = TkMacOSXGetClipRgn(d); if (!dontDraw) { @@ -1765,6 +1767,7 @@ end: dc.clipRgn = NULL; } *dcPtr = dc; + [pool drain]; return !dontDraw; } @@ -1788,6 +1791,7 @@ void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr) { + NSAutoreleasePool *pool = [NSAutoreleasePool new]; if (dcPtr->context) { CGContextSynchronize(dcPtr->context); [[dcPtr->view window] setViewsNeedDisplay:YES]; @@ -1804,6 +1808,7 @@ TkMacOSXRestoreDrawingContext( #ifdef TK_MAC_DEBUG bzero(dcPtr, sizeof(TkMacOSXDrawingContext)); #endif /* TK_MAC_DEBUG */ + [pool drain]; } /* @@ -1829,7 +1834,8 @@ TkMacOSXGetClipRgn( { MacDrawable *macDraw = (MacDrawable *) drawable; HIShapeRef clipRgn = NULL; - + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macDraw->winPtr); #ifdef TK_MAC_DEBUG_DRAWING @@ -1854,7 +1860,7 @@ TkMacOSXGetClipRgn( } else if (macDraw->visRgn) { clipRgn = HIShapeCreateCopy(macDraw->visRgn); } - + [pool drain]; return clipRgn; } @@ -1907,7 +1913,8 @@ TkpClipDrawableToRect( { MacDrawable *macDraw = (MacDrawable *) d; NSView *view = TkMacOSXDrawableView(macDraw); - + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + if (macDraw->drawRgn) { CFRelease(macDraw->drawRgn); macDraw->drawRgn = NULL; @@ -1940,6 +1947,7 @@ TkpClipDrawableToRect( macDraw->flags &= ~TK_FOCUSED_VIEW; } } + [pool drain]; } /* |