winemac: Move memory management of liveResizeDisplayTimer into property setter.

This commit is contained in:
Ken Thomases 2013-09-18 13:00:51 -05:00 committed by Alexandre Julliard
parent a3197b8ad0
commit d55d2ec85a
1 changed files with 19 additions and 10 deletions

View File

@ -158,6 +158,8 @@ @interface WineWindow ()
@property (assign, nonatomic) void* imeData; @property (assign, nonatomic) void* imeData;
@property (nonatomic) BOOL commandDone; @property (nonatomic) BOOL commandDone;
@property (retain, nonatomic) NSTimer* liveResizeDisplayTimer;
- (void) updateColorSpace; - (void) updateColorSpace;
- (BOOL) becameEligibleParentOrChild; - (BOOL) becameEligibleParentOrChild;
@ -468,6 +470,7 @@ @implementation WineWindow
@synthesize colorKeyed, colorKeyRed, colorKeyGreen, colorKeyBlue; @synthesize colorKeyed, colorKeyRed, colorKeyGreen, colorKeyBlue;
@synthesize usePerPixelAlpha; @synthesize usePerPixelAlpha;
@synthesize imeData, commandDone; @synthesize imeData, commandDone;
@synthesize liveResizeDisplayTimer;
+ (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf
windowFrame:(NSRect)window_frame windowFrame:(NSRect)window_frame
@ -1183,6 +1186,16 @@ - (void) setShape:(NSBezierPath*)newShape
[self checkTransparency]; [self checkTransparency];
} }
- (void) setLiveResizeDisplayTimer:(NSTimer*)newTimer
{
if (newTimer != liveResizeDisplayTimer)
{
[liveResizeDisplayTimer invalidate];
[liveResizeDisplayTimer release];
liveResizeDisplayTimer = [newTimer retain];
}
}
- (void) makeFocused:(BOOL)activate - (void) makeFocused:(BOOL)activate
{ {
[self orderBelow:nil orAbove:nil activate:activate]; [self orderBelow:nil orAbove:nil activate:activate];
@ -1463,9 +1476,7 @@ - (void)windowDidDeminiaturize:(NSNotification *)notification
- (void) windowDidEndLiveResize:(NSNotification *)notification - (void) windowDidEndLiveResize:(NSNotification *)notification
{ {
[liveResizeDisplayTimer invalidate]; self.liveResizeDisplayTimer = nil;
[liveResizeDisplayTimer release];
liveResizeDisplayTimer = nil;
} }
- (void)windowDidMiniaturize:(NSNotification *)notification - (void)windowDidMiniaturize:(NSNotification *)notification
@ -1587,13 +1598,11 @@ - (void) windowWillStartLiveResize:(NSNotification *)notification
// //
// We address this by "manually" asking our windows to check if they need // We address this by "manually" asking our windows to check if they need
// redrawing every so often (during live resize only). // redrawing every so often (during live resize only).
[self windowDidEndLiveResize:nil]; self.liveResizeDisplayTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/30.0
liveResizeDisplayTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/30.0 target:self
target:self selector:@selector(displayIfNeeded)
selector:@selector(displayIfNeeded) userInfo:nil
userInfo:nil repeats:YES];
repeats:YES];
[liveResizeDisplayTimer retain];
[[NSRunLoop currentRunLoop] addTimer:liveResizeDisplayTimer [[NSRunLoop currentRunLoop] addTimer:liveResizeDisplayTimer
forMode:NSRunLoopCommonModes]; forMode:NSRunLoopCommonModes];
} }