Use zeroing weak reference to NSWindow instance (10.8)

This commit is contained in:
Allan Odgaard
2016-08-14 11:16:35 +02:00
parent 7cff411632
commit 8e04e888d1

View File

@@ -19,7 +19,7 @@ OAK_DEBUG_VAR(OakToolTip);
- (void)showAtLocation:(NSPoint)aPoint forScreen:(NSScreen*)aScreen;
@end
static __unsafe_unretained OakToolTip* LastToolTip;
static __weak OakToolTip* LastToolTip;
@implementation OakToolTip
+ (void)initialize
@@ -62,12 +62,6 @@ static __unsafe_unretained OakToolTip* LastToolTip;
return self;
}
- (void)dealloc
{
D(DBF_OakToolTip, bug("\n"););
LastToolTip = nil;
}
- (void)setFont:(NSFont*)aFont
{
ASSERT(aFont != nil);
@@ -221,9 +215,7 @@ void OakShowToolTip (NSString* msg, NSPoint location)
}
[toolTip showAtLocation:location forScreen:screen];
if(OakToolTip* lastToolTip = LastToolTip)
[lastToolTip performSelector:@selector(orderOut:) withObject:nil afterDelay:0];
[LastToolTip performSelector:@selector(orderOut:) withObject:nil afterDelay:0];
LastToolTip = toolTip;
}
}