summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWm.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/tkMacOSXWm.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/tkMacOSXWm.c')
-rw-r--r--macosx/tkMacOSXWm.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 69d3cfb..4ce2206 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -390,6 +390,7 @@ static void RemapWindows(TkWindow *winPtr,
@end
@implementation TKWindow(TKWm)
+
- (BOOL) canBecomeKeyWindow
{
TkWindow *winPtr = TkMacOSXGetTkWindow(self);
@@ -399,16 +400,38 @@ static void RemapWindows(TkWindow *winPtr,
kWindowNoActivatesAttribute)) ? NO : YES;
}
+#if DEBUG_ZOMBIES
- (id) retain
{
-#if DEBUG_ZOMBIES
+ id result = [super retain];
const char *title = [[self title] UTF8String];
- if (title != NULL) {
- printf("Retaining %s with count %lu\n", title, [self retainCount]);
+ if (title == nil) {
+ title = "unnamed window";
}
-#endif
- return [super retain];
+ printf("Retained <%s>. Count is: %lu\n", title, [self retainCount]);
+ return result;
+}
+
+- (id) autorelease
+{
+ id result = [super autorelease];
+ const char *title = [[self title] UTF8String];
+ if (title == nil) {
+ title = "unnamed window";
+ }
+ printf("Autoreleased <%s>. Count is %lu\n", title, [self retainCount]);
+ return result;
+}
+
+- (oneway void) release {
+ const char *title = [[self title] UTF8String];
+ if (title == nil) {
+ title = "unnamed window";
+ }
+ printf("Releasing <%s>. Count is %lu\n", title, [self retainCount]);
+ [super release];
}
+#endif
@end
#pragma mark -
@@ -847,6 +870,15 @@ TkWmDeadWindow(
if (winPtr->window) {
((MacDrawable *) winPtr->window)->view = nil;
}
+#if DEBUG_ZOMBIES
+ {
+ const char *title = [[window title] UTF8String];
+ if (title == nil) {
+ title = "unnamed window";
+ }
+ printf("Closing <%s>. Count is: %lu\n", title, [window retainCount]);
+ }
+#endif
[window release];
wmPtr->window = NULL;
/* Activate the highest window left on the screen. */
@@ -5447,6 +5479,8 @@ TkMacOSXMakeRealWindowExist(
*/
}
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
WindowClass macClass = wmPtr->macClass;
wmPtr->attributes &= (tkAlwaysValidAttributes |
macClassAttrs[macClass].validAttrs);
@@ -5530,6 +5564,8 @@ TkMacOSXMakeRealWindowExist(
TkMacOSXRegisterOffScreenWindow((Window) macWin, window);
macWin->flags |= TK_HOST_EXISTS;
+
+ [pool drain];
}
/*