From 195b45848ee251e37b16dddf60e1add44c272932 Mon Sep 17 00:00:00 2001 From: CaS Date: Mon, 21 Jul 2003 10:41:10 +0000 Subject: [PATCH] Applied memory leak fixing patches git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17277 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 12 ++++++++++++ Headers/gnustep/gui/NSComboBoxCell.h | 2 +- Source/GSMemoryPanel.m | 11 +++++++++++ Source/GSServicesManager.m | 5 +++-- Source/NSComboBoxCell.m | 2 +- Source/NSMenuView.m | 1 + Source/NSOutlineView.m | 9 ++------- Source/NSPageLayout.m | 7 +++++++ Source/NSSelection.m | 8 ++++++++ Source/NSToolbar.m | 12 +++++++----- 10 files changed, 53 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9cdff9f9b..764a9e3af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-07-21 Andrew Ruder + + * Source/GSMemoryPanel.m: Add dealloc method + * Source/NSOutlineView.m: Efficiency tweak. + * Headers/AppKit/NSComboBoxCell.h:Fix misplaced semicolon + * Source/NSSelection.m: Fix memory leak + * Source/NSComboBoxCell.m: Fix misplaced semicolon. + * Source/NSPageLayout.m: Fix memory leak. + * Source/NSMenuView.m: Fix memory leak. + * Source/NSToolbar.m: Fix memory leak and tidy + * Source/GSServicesManager.m: Clarify retain/release of timer. + 2003-07-21 Richard Frith-Macdonald * Source/NSFileWrapper.m: Tidy initialisation and fix leak in diff --git a/Headers/gnustep/gui/NSComboBoxCell.h b/Headers/gnustep/gui/NSComboBoxCell.h index 712dddcff..41f6411f1 100644 --- a/Headers/gnustep/gui/NSComboBoxCell.h +++ b/Headers/gnustep/gui/NSComboBoxCell.h @@ -44,7 +44,7 @@ float _itemHeight; int _selectedItem; -@private; +@private id _popup; } diff --git a/Source/GSMemoryPanel.m b/Source/GSMemoryPanel.m index ab3c47597..8a03692dd 100644 --- a/Source/GSMemoryPanel.m +++ b/Source/GSMemoryPanel.m @@ -277,6 +277,17 @@ static GSMemoryPanel *sharedGSMemoryPanel = nil; return self; } +- (void) dealloc +{ + RELEASE(table); + RELEASE(classArray); + RELEASE(countArray); + RELEASE(totalArray); + RELEASE(peakArray); + + [super dealloc]; +} + - (int) numberOfRowsInTableView: (NSTableView *)aTableView { return [countArray count]; diff --git a/Source/GSServicesManager.m b/Source/GSServicesManager.m index 5940c542d..446867278 100644 --- a/Source/GSServicesManager.m +++ b/Source/GSServicesManager.m @@ -440,11 +440,11 @@ static NSString *disabledName = @".GNUstepDisabled"; * Check for changes to the services cache every thirty seconds. */ manager->_timer = - [NSTimer scheduledTimerWithTimeInterval: 30.0 + RETAIN([NSTimer scheduledTimerWithTimeInterval: 30.0 target: manager selector: @selector(loadServices) userInfo: nil - repeats: YES]; + repeats: YES]); [manager loadServices]; return manager; @@ -522,6 +522,7 @@ static NSString *disabledName = @".GNUstepDisabled"; appName = [[NSProcessInfo processInfo] processName]; [_timer invalidate]; + RELEASE(_timer); NSUnregisterServicesProvider(appName); RELEASE(_languages); RELEASE(_returnInfo); diff --git a/Source/NSComboBoxCell.m b/Source/NSComboBoxCell.m index ca6d93cba..aa86ce00f 100644 --- a/Source/NSComboBoxCell.m +++ b/Source/NSComboBoxCell.m @@ -47,7 +47,7 @@ { NSBrowser *browser; -@private; +@private NSComboBoxCell *_cell; BOOL _stopped; } diff --git a/Source/NSMenuView.m b/Source/NSMenuView.m index 1def87d7c..90a8d26ed 100644 --- a/Source/NSMenuView.m +++ b/Source/NSMenuView.m @@ -1410,6 +1410,7 @@ _addLeftBorderOffsetToRect(NSRect aRect) - (void) dealloc { + RELEASE (attr); RELEASE (button); [super dealloc]; } diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m index ddc575d1e..46d05733d 100644 --- a/Source/NSOutlineView.m +++ b/Source/NSOutlineView.m @@ -129,17 +129,12 @@ static NSImage *unexpandable = nil; _itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 64); - _items = [NSMutableArray array]; - _expandedItems = [NSMutableArray array]; + _items = [NSMutableArray new]; + _expandedItems = [NSMutableArray new]; _levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 64); - - // Retain items - RETAIN(_items); - RETAIN(_expandedItems); - return self; } diff --git a/Source/NSPageLayout.m b/Source/NSPageLayout.m index 0f9cc9cb8..6f4d9e13e 100644 --- a/Source/NSPageLayout.m +++ b/Source/NSPageLayout.m @@ -179,6 +179,13 @@ static NSPageLayout *shared_instance; return self; } +- (void) dealloc +{ + RELEASE (_accessoryView); + + [super dealloc]; +} + // // Running the Panel // diff --git a/Source/NSSelection.m b/Source/NSSelection.m index 8c385bb3d..659f758a1 100644 --- a/Source/NSSelection.m +++ b/Source/NSSelection.m @@ -176,6 +176,14 @@ typedef enum return self; } +- (void) dealloc +{ + RELEASE(_descriptionData); + + [super dealloc]; +} + + // // Describing a Selection // diff --git a/Source/NSToolbar.m b/Source/NSToolbar.m index 61bdaaa38..497e2a82c 100644 --- a/Source/NSToolbar.m +++ b/Source/NSToolbar.m @@ -52,11 +52,16 @@ static const int current_version = 1; @end @implementation GSToolbarView +- (void) dealloc +{ + RELEASE(_toolbar); + + [super dealloc]; +} - (void) setToolbar: (NSToolbar *)toolbar { ASSIGN(_toolbar, toolbar); } - - (NSToolbar *) toolbar { return _toolbar; @@ -182,6 +187,7 @@ static const int current_version = 1; - (void) dealloc { DESTROY (_identifier); + DESTROY (_configurationDictionary); if (_delegate != nil) { @@ -242,10 +248,6 @@ static const int current_version = 1; - (void) setConfigurationFromDictionary: (NSDictionary *)configDict { - if(!_configurationDictionary) - { - RELEASE(_configurationDictionary); - } ASSIGN(_configurationDictionary, configDict); }