summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWm.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2015-12-07 02:02:44 (GMT)
committerKevin Walzer <kw@codebykevin.com>2015-12-07 02:02:44 (GMT)
commit6aad9c9b454d5334c3e36cd2bf623dae8369defe (patch)
tree740de6d2fe3af13e22213ec4ef7e027a3d1d93ee /macosx/tkMacOSXWm.c
parent3c354d91432f5a951efb12e957299cacdeafb897 (diff)
downloadtk-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/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 fb58904..5ec38ca 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -386,6 +386,7 @@ static void RemapWindows(TkWindow *winPtr,
@end
@implementation TKWindow(TKWm)
+
- (BOOL) canBecomeKeyWindow
{
TkWindow *winPtr = TkMacOSXGetTkWindow(self);
@@ -395,16 +396,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 -
@@ -842,6 +865,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. */
@@ -5507,6 +5539,8 @@ TkMacOSXMakeRealWindowExist(
*/
}
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
WindowClass macClass = wmPtr->macClass;
wmPtr->attributes &= (tkAlwaysValidAttributes |
macClassAttrs[macClass].validAttrs);
@@ -5590,6 +5624,8 @@ TkMacOSXMakeRealWindowExist(
TkMacOSXRegisterOffScreenWindow((Window) macWin, window);
macWin->flags |= TK_HOST_EXISTS;
+
+ [pool drain];
}
/*