summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDraw.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2015-12-07 02:04:45 (GMT)
committerKevin Walzer <kw@codebykevin.com>2015-12-07 02:04:45 (GMT)
commite82200cb0ca4389ea75f8ae0c2096358a985c14e (patch)
tree91a16332713cfc52d7f400a64513ff1e5646cd35 /macosx/tkMacOSXDraw.c
parent7f2c3a3f39d6a76f0656cbffc7e589b1a59bc346 (diff)
downloadtk-e82200cb0ca4389ea75f8ae0c2096358a985c14e.zip
tk-e82200cb0ca4389ea75f8ae0c2096358a985c14e.tar.gz
tk-e82200cb0ca4389ea75f8ae0c2096358a985c14e.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.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 45a07c7..b3c2499 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];
}
/*