From 07fd35c734c65429dc720d0d2ff882a16308da61 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 17 Apr 2008 13:40:17 -0400 Subject: [PATCH] Turning off GC and adding back manual memory management --- MacGDBp.xcodeproj/project.pbxproj | 1 - Source/BSSourceView.m | 14 +++++++++++++- Source/Breakpoint.m | 11 ++++++++++- Source/ConnectWindowController.m | 5 +++-- Source/DebuggerConnection.m | 15 +++++++++++++-- Source/DebuggerWindowController.m | 10 ++++++++++ Source/SocketWrapper.m | 11 ++++++++++- 7 files changed, 59 insertions(+), 8 deletions(-) diff --git a/MacGDBp.xcodeproj/project.pbxproj b/MacGDBp.xcodeproj/project.pbxproj index 4f3e313..20616a3 100644 --- a/MacGDBp.xcodeproj/project.pbxproj +++ b/MacGDBp.xcodeproj/project.pbxproj @@ -399,7 +399,6 @@ isa = XCBuildConfiguration; buildSettings = { GCC_C_LANGUAGE_STANDARD = c99; - GCC_ENABLE_OBJC_GC = required; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; diff --git a/Source/BSSourceView.m b/Source/BSSourceView.m index cf0d7e4..69d0d97 100644 --- a/Source/BSSourceView.m +++ b/Source/BSSourceView.m @@ -36,12 +36,24 @@ return self; } +/** + * Dealloc + */ +- (void)dealloc +{ + if (file != nil) + { + [file release]; + } +} + /** * Sets the file name as well as the text of the source view */ - (void)setFile:(NSString *)f { - file = f; + [file release]; + file = [f retain]; [textView setString:[NSString stringWithContentsOfFile:f]]; } diff --git a/Source/Breakpoint.m b/Source/Breakpoint.m index 26f5f8e..5d3ec5b 100644 --- a/Source/Breakpoint.m +++ b/Source/Breakpoint.m @@ -28,12 +28,21 @@ { if (self = [super init]) { - file = f; + file = [f retain]; line = l; } return self; } +/** + * Dealloc + */ +- (void)dealloc +{ + [file release]; + [super dealloc]; +} + /** * Determines if two breakpoints are equal */ diff --git a/Source/ConnectWindowController.m b/Source/ConnectWindowController.m index cb73ede..a31756d 100644 --- a/Source/ConnectWindowController.m +++ b/Source/ConnectWindowController.m @@ -18,6 +18,8 @@ #import "DebuggerWindowController.h" #import "AppDelegate.h" +static id instance = nil; + @implementation ConnectWindowController /** @@ -25,7 +27,6 @@ */ + (id)sharedController { - static id instance = nil; if (!instance) { instance = [[ConnectWindowController alloc] initWithWindowNibName:@"Connect"]; @@ -39,7 +40,7 @@ */ - (IBAction)connect:(id)sender { - [[DebuggerWindowController alloc] initWithPort:[port intValue] session:[session stringValue]]; + [[[DebuggerWindowController alloc] initWithPort:[port intValue] session:[session stringValue]] autorelease]; [[self window] orderOut:self]; } diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index e1a9c0c..1a9cf04 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -37,10 +37,10 @@ if (self = [super init]) { port = aPort; - session = aSession; + session = [aSession retain]; connected = NO; - windowController = wc; + windowController = [wc retain]; // now that we have our host information, open the socket socket = [[SocketWrapper alloc] initWithConnection:self]; @@ -50,6 +50,17 @@ return self; } +/** + * Deallocates the object + */ +- (void)dealloc +{ + [socket release]; + [session release]; + [windowController release]; + [super dealloc]; +} + /** * Gets the port number */ diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index 4cdacdc..e0498e3 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -44,6 +44,16 @@ return self; } +/** + * Dealloc + */ +- (void)dealloc +{ + [connection release]; + [expandedRegisters release]; + [super dealloc]; +} + /** * Before the display get's comfortable, set up the NSTextView to scroll horizontally */ diff --git a/Source/SocketWrapper.m b/Source/SocketWrapper.m index 77e8cda..27ea907 100644 --- a/Source/SocketWrapper.m +++ b/Source/SocketWrapper.m @@ -36,12 +36,21 @@ { if (self = [super init]) { - connection = cnx; + connection = [cnx retain]; port = [connection port]; } return self; } +/** + * Dealloc + */ +- (void)dealloc +{ + [connection release]; + [super dealloc]; +} + /** * Close our socket and clean up anything else */ -- 2.43.5