diff options
author | Sven Weidauer <sven.weidauer@gmail.com> | 2011-01-20 11:38:10 +0000 |
---|---|---|
committer | Sven Weidauer <sven.weidauer@gmail.com> | 2011-01-20 11:38:10 +0000 |
commit | 59321513593af496f22439a3305bb95d31330091 (patch) | |
tree | 1c6cc68fc6e302bd8599585e3a7764db4b13c31e /cocoa | |
parent | cd7293320173dfa5ae12810ec51b0708c8bae924 (diff) | |
download | netsurf-59321513593af496f22439a3305bb95d31330091.tar.gz netsurf-59321513593af496f22439a3305bb95d31330091.tar.bz2 |
Releasing objects in dealloc
svn path=/trunk/netsurf/; revision=11413
Diffstat (limited to 'cocoa')
-rw-r--r-- | cocoa/BrowserView.m | 16 | ||||
-rw-r--r-- | cocoa/BrowserViewController.m | 11 | ||||
-rw-r--r-- | cocoa/BrowserWindowController.m | 8 |
3 files changed, 34 insertions, 1 deletions
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m index b90879086..23a4c562c 100644 --- a/cocoa/BrowserView.m +++ b/cocoa/BrowserView.m @@ -36,6 +36,21 @@ static const CGFloat CaretWidth = 1.0; static const NSTimeInterval CaretBlinkTime = 0.8; +- (void) dealloc; +{ + [self setCaretTimer: nil]; + [super dealloc]; +} + +- (void) setCaretTimer: (NSTimer *)newTimer; +{ + if (newTimer != caretTimer) { + [caretTimer invalidate]; + [caretTimer release]; + caretTimer = [newTimer retain]; + } +} + static inline NSRect cocoa_get_caret_rect( BrowserView *view ) { NSRect caretRect = { @@ -51,7 +66,6 @@ static inline NSRect cocoa_get_caret_rect( BrowserView *view ) hasCaret = NO; [self setNeedsDisplayInRect: cocoa_get_caret_rect( self )]; - [caretTimer invalidate]; [self setCaretTimer: nil]; } diff --git a/cocoa/BrowserViewController.m b/cocoa/BrowserViewController.m index 7e109370f..654d6e80b 100644 --- a/cocoa/BrowserViewController.m +++ b/cocoa/BrowserViewController.m @@ -38,6 +38,17 @@ @synthesize status; @synthesize spinning; +- (void) dealloc; +{ + [self setUrl: nil]; + [self setBrowserView: nil]; + [self setWindowController: nil]; + [self setTitle: nil]; + [self setStatus: nil]; + + [super dealloc]; +} + - initWithBrowser: (struct browser_window *) bw; { if ((self = [super initWithNibName: @"Browser" bundle: nil]) == nil) return nil; diff --git a/cocoa/BrowserWindowController.m b/cocoa/BrowserWindowController.m index fa53492e9..84be95c56 100644 --- a/cocoa/BrowserWindowController.m +++ b/cocoa/BrowserWindowController.m @@ -37,6 +37,14 @@ return self; } +- (void) dealloc; +{ + [self setTabBar: nil]; + [self setTabView: nil]; + + [super dealloc]; +} + - (void) awakeFromNib; { [tabBar setShowAddTabButton: YES]; |