Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Be more paranoid about deallocing objects & holding on to timers

  • Loading branch information...
commit 1165c8730c1ec97d1e1d96cf09438c718df979f8 1 parent bbd7328
@uliwitness authored
Showing with 16 additions and 12 deletions.
  1. +4 −2 UKColorListView.m
  2. +2 −1  ULIPaintPathTool.m
  3. +10 −9 ULIPaintView.m
View
6 UKColorListView.m
@@ -7,6 +7,7 @@
//
#import "UKColorListView.h"
+#import "UKHelperMacros.h"
@implementation UKColorListView
@@ -55,11 +56,12 @@ -(id) initWithFrame: (NSRect)frame
-(void) dealloc
{
- [colorList writeToFile: nil]; // Save to default location.
- [colorList release];
[[NSNotificationCenter defaultCenter] removeObserver:self
name: NSColorPanelColorDidChangeNotification
object: [NSColorPanel sharedColorPanel]];
+ [colorList writeToFile: nil]; // Save to default location.
+ DESTROY_DEALLOC(colorList);
+
[super dealloc];
}
View
3  ULIPaintPathTool.m
@@ -27,13 +27,14 @@
#import "ULIPaintPathTool.h"
#import "ULIPaintView.h"
+#import "UKHelperMacros.h"
@implementation ULIPaintPathTool
-(void) dealloc
{
- [currentPath release];
+ DESTROY_DEALLOC(currentPath);
[super dealloc];
}
View
19 ULIPaintView.m
@@ -27,6 +27,7 @@
#import "ULIPaintView.h"
#import "ULIPaintTool.h"
+#import "UKHelperMacros.h"
@implementation ULIPaintView
@@ -72,14 +73,14 @@ -(void) dealloc
sCurrentPaintView = nil;
}
- [undoManager release];
- [image release];
- [tempTrackImage release];
- [floatingSelectionImage release];
- [fillColor release];
- [lineColor release];
+ DESTROY_DEALLOC(undoManager);
+ DESTROY_DEALLOC(image);
+ DESTROY_DEALLOC(tempTrackImage);
+ DESTROY_DEALLOC(floatingSelectionImage);
+ DESTROY_DEALLOC(fillColor);
+ DESTROY_DEALLOC(lineColor);
[selectionTimer invalidate];
- selectionTimer = nil;
+ DESTROY_DEALLOC(selectionTimer);
[super dealloc];
}
@@ -590,7 +591,7 @@ -(BOOL) becomeFirstResponder
if( !selectionTimer )
{
- selectionTimer = [NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector:@selector(animateSelection:) userInfo: nil repeats: YES];
+ selectionTimer = [[NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector:@selector(animateSelection:) userInfo: nil repeats: YES] retain];
[[NSRunLoop currentRunLoop] addTimer: selectionTimer forMode: NSEventTrackingRunLoopMode];
}
@@ -608,7 +609,7 @@ -(BOOL) becomeFirstResponder
-(BOOL) resignFirstResponder
{
[selectionTimer invalidate];
- selectionTimer = nil;
+ DESTROY(selectionTimer);
return YES;
}
Please sign in to comment.
Something went wrong with that request. Please try again.