From 59321513593af496f22439a3305bb95d31330091 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Thu, 20 Jan 2011 11:38:10 +0000 Subject: Releasing objects in dealloc svn path=/trunk/netsurf/; revision=11413 --- cocoa/BrowserView.m | 16 +++++++++++++++- cocoa/BrowserViewController.m | 11 +++++++++++ cocoa/BrowserWindowController.m | 8 ++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) 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]; -- cgit v1.2.3