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 | a276f91565b6977f3f437572d730efa562f4cd43 (patch) | |
tree | 740de6d2fe3af13e22213ec4ef7e027a3d1d93ee /macosx/tkMacOSXDraw.c | |
parent | 0b529d0b25a5ec18c4a4134cf3e3cb57395b47ca (diff) | |
download | tk-a276f91565b6977f3f437572d730efa562f4cd43.zip tk-a276f91565b6977f3f437572d730efa562f4cd43.tar.gz tk-a276f91565b6977f3f437572d730efa562f4cd43.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]; } /* |