From b7d4924c5c3f88217b3e3dec2efdbc3353140d86 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 13 Sep 2019 04:01:27 -0400 Subject: [PATCH] Convert the entire project to ARC. --- MacGDBp.xcodeproj/project.pbxproj | 4 ++++ Source/BSLineNumberRulerView.mm | 4 ++-- Source/BSProtocolThreadInvoker.h | 1 + Source/BSProtocolThreadInvoker.m | 5 +--- Source/BSSourceView.h | 4 ++-- Source/BSSourceView.mm | 39 ++++++------------------------- Source/BSSourceViewTextView.h | 7 ++---- Source/Breakpoint.h | 4 ++-- Source/Breakpoint.m | 13 +++-------- Source/BreakpointController.h | 8 +++---- Source/BreakpointController.m | 2 +- Source/BreakpointManager.h | 2 +- Source/BreakpointManager.m | 14 ++--------- Source/DebuggerBackEnd.m | 11 +++------ Source/DebuggerController.h | 16 ++++++------- Source/DebuggerController.m | 27 +-------------------- Source/DebuggerModel.m | 8 ------- Source/EvalController.m | 6 ----- Source/LoggingController.m | 14 ----------- Source/MessageQueue.m | 16 ++++--------- Source/NSXMLElementAdditions.m | 6 ++--- Source/PreferencesController.m | 9 ------- Source/ProtocolClient.m | 24 +++++++------------ Source/StackFrame.m | 8 ------- Source/Tests/DebuggerModelTest.m | 3 +-- Source/VariableNode.m | 12 ---------- 26 files changed, 62 insertions(+), 205 deletions(-) diff --git a/MacGDBp.xcodeproj/project.pbxproj b/MacGDBp.xcodeproj/project.pbxproj index 9590db0..07258a4 100644 --- a/MacGDBp.xcodeproj/project.pbxproj +++ b/MacGDBp.xcodeproj/project.pbxproj @@ -614,6 +614,7 @@ 1E8C709F1BDB167F00D333DC /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; @@ -638,6 +639,7 @@ 1E8C70A01BDB167F00D333DC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; @@ -658,6 +660,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_ENTITLEMENTS = MacGDBp.entitlements; COMBINE_HIDPI_IMAGES = YES; @@ -680,6 +683,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_ENTITLEMENTS = MacGDBp.entitlements; COMBINE_HIDPI_IMAGES = YES; diff --git a/Source/BSLineNumberRulerView.mm b/Source/BSLineNumberRulerView.mm index bfe0eba..7b1d253 100644 --- a/Source/BSLineNumberRulerView.mm +++ b/Source/BSLineNumberRulerView.mm @@ -225,8 +225,8 @@ const CGFloat kRulerRightPadding = 2.5; - (NSAttributedString*)attributedStringForLineNumber:(unsigned long)line { NSString* format = [NSString stringWithFormat:@"%lu", line]; - return [[[NSAttributedString alloc] initWithString:format - attributes:[self fontAttributes]] autorelease]; + return [[NSAttributedString alloc] initWithString:format + attributes:[self fontAttributes]]; } /** diff --git a/Source/BSProtocolThreadInvoker.h b/Source/BSProtocolThreadInvoker.h index da6543a..5cec0a5 100644 --- a/Source/BSProtocolThreadInvoker.h +++ b/Source/BSProtocolThreadInvoker.h @@ -15,6 +15,7 @@ */ #import +#import // BSProtocolThreadInvoker will forward all messages that are part of |protocol| // to its target |object| on the specified |thread| in the optional modes. This diff --git a/Source/BSProtocolThreadInvoker.m b/Source/BSProtocolThreadInvoker.m index 24c04e4..2dc8c1d 100644 --- a/Source/BSProtocolThreadInvoker.m +++ b/Source/BSProtocolThreadInvoker.m @@ -75,7 +75,7 @@ _object = object; _protocol = protocol; _thread = thread; - _modes = [runLoopModes retain]; + _modes = [runLoopModes copy]; _invocations = [[NSMutableArray alloc] init]; [self performSelector:@selector(addRunLoopObserver) @@ -90,9 +90,6 @@ - (void)dealloc { [self removeRunLoopObserver]; - [_modes release]; - [_invocations release]; - [super dealloc]; } - (BOOL)conformsToProtocol:(Protocol*)protocol diff --git a/Source/BSSourceView.h b/Source/BSSourceView.h index ed11ff9..ac50431 100644 --- a/Source/BSSourceView.h +++ b/Source/BSSourceView.h @@ -38,7 +38,7 @@ NSString* file_; NSUInteger markedLine_; - id delegate_; + id __weak delegate_; } @property (nonatomic, readonly) NSTextView* textView; @@ -46,7 +46,7 @@ @property (nonatomic, retain) NSSet* markers; @property (nonatomic, retain) NSString* file; @property (nonatomic, assign) NSUInteger markedLine; -@property (nonatomic, assign) id delegate; +@property (nonatomic, weak) id delegate; - (void)setFile:(NSString*)f; - (void)setString:(NSString*)source asFile:(NSString*)path; diff --git a/Source/BSSourceView.mm b/Source/BSSourceView.mm index 9812b40..5b922ef 100644 --- a/Source/BSSourceView.mm +++ b/Source/BSSourceView.mm @@ -51,24 +51,8 @@ return self; } -/** - * Dealloc - */ -- (void)dealloc -{ - [file_ release]; - [markers_ release]; - - [scrollView_ removeFromSuperview]; - [textView_ removeFromSuperview]; - - [super dealloc]; -} - - (void)setMarkers:(NSSet*)markers { - [markers_ release]; markers_ = [markers copy]; - [ruler_ setNeedsDisplay:YES]; } @@ -83,10 +67,7 @@ */ - (void)setFile:(NSString*)f { - if (file_ != f) { - [file_ release]; - file_ = [f retain]; - } + file_ = f; if (![[NSFileManager defaultManager] fileExistsAtPath:f]) { [textView_ setString:@""]; @@ -101,10 +82,7 @@ */ - (void)setString:(NSString*)source asFile:(NSString*)path { - if (path != file_) { - [file_ release]; - file_ = [path copy]; - } + file_ = path; // Write the source out as a temporary file so it can be highlighted. NSError* error = nil; @@ -159,7 +137,7 @@ - (void)setupViews { // Create the scroll view. - scrollView_ = [[[NSScrollView alloc] initWithFrame:[self bounds]] autorelease]; + scrollView_ = [[NSScrollView alloc] initWithFrame:[self bounds]]; [scrollView_ setHasHorizontalScroller:YES]; [scrollView_ setHasVerticalScroller:YES]; [scrollView_ setAutohidesScrollers:YES]; @@ -172,7 +150,7 @@ NSRect textFrame; textFrame.origin = NSMakePoint(0.0, 0.0); textFrame.size = [scrollView_ contentSize]; - textView_ = [[[BSSourceViewTextView alloc] initWithFrame:textFrame] autorelease]; + textView_ = [[BSSourceViewTextView alloc] initWithFrame:textFrame]; [textView_ setSourceView:self]; [textView_ setEditable:NO]; [textView_ setFont:[NSFont fontWithName:@"Monaco" size:10.0]]; @@ -187,7 +165,7 @@ [scrollView_ setDocumentView:textView_]; // Set up the ruler. - ruler_ = [[[BSLineNumberRulerView alloc] initWithSourceView:self] autorelease]; + ruler_ = [[BSLineNumberRulerView alloc] initWithSourceView:self]; [scrollView_ setVerticalRulerView:ruler_]; [scrollView_ setHasHorizontalRuler:NO]; [scrollView_ setHasVerticalRuler:YES]; @@ -225,16 +203,13 @@ // PHP uses   in the highlighted output, which should be converted // back to normal spaces. [stringData replaceOccurrencesOfString:@"\u00A0" withString:@" " options:0 range:NSMakeRange(0, stringData.length)]; - [[textView_ textStorage] setAttributedString:source]; - [source release]; + [[self->textView_ textStorage] setAttributedString:source]; } else { NSLog(@"Failed to highlight PHP file %@: %@", filePath, [[errPipe fileHandleForReading] readDataToEndOfFile]); [self setPlainTextStringFromFile:filePath]; } - [ruler_ performLayout]; - - [task release]; + [self->ruler_ performLayout]; if (handler) handler(); diff --git a/Source/BSSourceViewTextView.h b/Source/BSSourceViewTextView.h index 0fd27ba..4ea0438 100644 --- a/Source/BSSourceViewTextView.h +++ b/Source/BSSourceViewTextView.h @@ -20,11 +20,8 @@ // This custom subclass of NSTextView simply draws a red rectangle over the text // for the current value of BSSourceView.markedLine. -@interface BSSourceViewTextView : NSTextView { - @private - BSSourceView* sourceView_; // weak -} +@interface BSSourceViewTextView : NSTextView -@property (nonatomic, assign) BSSourceView* sourceView; +@property (nonatomic, weak) BSSourceView* sourceView; @end diff --git a/Source/Breakpoint.h b/Source/Breakpoint.h index faa4df8..fe2e217 100644 --- a/Source/Breakpoint.h +++ b/Source/Breakpoint.h @@ -24,13 +24,13 @@ extern NSString* const kBreakpointTypeFunctionEntry; @interface Breakpoint : NSObject // The type of breakpoint, one of the kBreakpointType constants above. -@property (readonly) NSString* type; +@property (weak, readonly) NSString* type; // The unique identifier assigned by the debugger engine, only valid while // connected. @property (readwrite, assign) unsigned long debuggerId; -@property(nonatomic, readonly) NSString* displayValue; +@property(weak, nonatomic, readonly) NSString* displayValue; // kBreakpointTypeFile: @property (readonly) NSString* file; diff --git a/Source/Breakpoint.m b/Source/Breakpoint.m index 7a7b55e..744cf5d 100644 --- a/Source/Breakpoint.m +++ b/Source/Breakpoint.m @@ -22,7 +22,7 @@ NSString* const kBreakpointTypeFile = @"line"; NSString* const kBreakpointTypeFunctionEntry = @"call"; @implementation Breakpoint { - NSString* _type; // weak + NSString* __weak _type; unsigned long _debuggerId; NSString* _file; @@ -32,7 +32,7 @@ NSString* const kBreakpointTypeFunctionEntry = @"call"; + (instancetype)breakpointAtLine:(unsigned long)line inFile:(NSString*)file { - Breakpoint* breakpoint = [[[Breakpoint alloc] init] autorelease]; + Breakpoint* breakpoint = [[Breakpoint alloc] init]; breakpoint->_type = kBreakpointTypeFile; breakpoint->_file = [file copy]; breakpoint->_line = line; @@ -41,7 +41,7 @@ NSString* const kBreakpointTypeFunctionEntry = @"call"; + (instancetype)breakpointOnFunctionNamed:(NSString*)name { - Breakpoint* breakpoint = [[[Breakpoint alloc] init] autorelease]; + Breakpoint* breakpoint = [[Breakpoint alloc] init]; breakpoint->_type = kBreakpointTypeFunctionEntry; breakpoint->_functionName = [name copy]; return breakpoint; @@ -66,13 +66,6 @@ NSString* const kBreakpointTypeFunctionEntry = @"call"; return self; } -- (void)dealloc -{ - [_file release]; - [_functionName release]; - [super dealloc]; -} - /** * Returns the string to display in the breakpoints list. */ diff --git a/Source/BreakpointController.h b/Source/BreakpointController.h index 41abcec..442c5f3 100644 --- a/Source/BreakpointController.h +++ b/Source/BreakpointController.h @@ -21,11 +21,11 @@ @interface BreakpointController : NSViewController -@property(nonatomic, assign) IBOutlet NSPopUpButton* addBreakpointButton; -@property(nonatomic, assign) IBOutlet NSArrayController* arrayController; +@property(nonatomic, weak) IBOutlet NSPopUpButton* addBreakpointButton; +@property(nonatomic, weak) IBOutlet NSArrayController* arrayController; -@property(nonatomic, assign) IBOutlet NSWindow* addFunctionBreakpointWindow; -@property(nonatomic, assign) IBOutlet NSTextField* functionNameField; +@property(nonatomic, weak) IBOutlet NSWindow* addFunctionBreakpointWindow; +@property(nonatomic, weak) IBOutlet NSTextField* functionNameField; - (instancetype)initWithBreakpointManager:(BreakpointManager*)breakpointManager sourceView:(BSSourceView*)sourceView; diff --git a/Source/BreakpointController.m b/Source/BreakpointController.m index 99f495d..b7047e0 100644 --- a/Source/BreakpointController.m +++ b/Source/BreakpointController.m @@ -24,7 +24,7 @@ BSSourceView* _sourceView; - NSArrayController* _arrayController; + NSArrayController* __weak _arrayController; } /** diff --git a/Source/BreakpointManager.h b/Source/BreakpointManager.h index 3cb4a7d..8537c36 100644 --- a/Source/BreakpointManager.h +++ b/Source/BreakpointManager.h @@ -20,7 +20,7 @@ @interface BreakpointManager : NSObject -@property(readwrite, assign) DebuggerBackEnd* connection; +@property(readwrite, weak) DebuggerBackEnd* connection; @property(readonly) NSMutableArray* breakpoints; - (void)addBreakpoint:(Breakpoint*)bp; diff --git a/Source/BreakpointManager.m b/Source/BreakpointManager.m index e79dfac..0cfea23 100644 --- a/Source/BreakpointManager.m +++ b/Source/BreakpointManager.m @@ -27,7 +27,7 @@ NSMutableArray* _breakpoints; NSMutableArray* _savedBreakpoints; - DebuggerBackEnd* _connection; + DebuggerBackEnd* __weak _connection; } - (id)init @@ -41,19 +41,13 @@ if (savedBreakpoints) { [_savedBreakpoints addObjectsFromArray:savedBreakpoints]; for (NSDictionary* d in savedBreakpoints) { - [_breakpoints addObject:[[[Breakpoint alloc] initWithDictionary:d] autorelease]]; + [_breakpoints addObject:[[Breakpoint alloc] initWithDictionary:d]]; } } } return self; } -- (void)dealloc { - [_breakpoints release]; - [_savedBreakpoints release]; - [super dealloc]; -} - /** * Registers a breakpoint at a given line */ @@ -77,10 +71,6 @@ - (Breakpoint*)removeBreakpoint:(Breakpoint*)bp { if ([_breakpoints containsObject:bp]) { - // Keep the breakpoint alive after it is removed from the breakpoints - // array. - [[bp retain] autorelease]; - [self willChangeValueForKey:@"breakpoints"]; [_breakpoints removeObject:bp]; [self didChangeValueForKey:@"breakpoints"]; diff --git a/Source/DebuggerBackEnd.m b/Source/DebuggerBackEnd.m index 778c04a..6f8c3ca 100644 --- a/Source/DebuggerBackEnd.m +++ b/Source/DebuggerBackEnd.m @@ -42,11 +42,6 @@ return self; } -- (void)dealloc { - [_client release]; - [super dealloc]; -} - // Getters ///////////////////////////////////////////////////////////////////// #pragma mark Getters @@ -332,7 +327,7 @@ ProtocolClientMessageHandler handler = ^(NSXMLDocument* message) { [tempStack addObject:[self transformXMLToStackFrame:message]]; if (i == depth - 1) { - [self.model updateStack:[tempStack autorelease]]; + [self.model updateStack:tempStack]; } }; [_client sendCommandWithFormat:@"stack_get -d %d" handler:handler, i]; @@ -345,7 +340,7 @@ */ - (StackFrame*)transformXMLToStackFrame:(NSXMLDocument*)response { NSXMLElement* xmlframe = (NSXMLElement*)[[[response rootElement] children] objectAtIndex:0]; - StackFrame* frame = [[[StackFrame alloc] init] autorelease]; + StackFrame* frame = [[StackFrame alloc] init]; frame.index = [[[xmlframe attributeForName:@"level"] stringValue] intValue]; frame.filename = [[xmlframe attributeForName:@"filename"] stringValue]; frame.lineNumber = [[[xmlframe attributeForName:@"lineno"] stringValue] intValue]; @@ -375,7 +370,7 @@ if (addVariables) { for (NSXMLElement* elm in addVariables) { VariableNode* node = [[VariableNode alloc] initWithXMLNode:elm]; - [variables addObject:[node autorelease]]; + [variables addObject:node]; } } diff --git a/Source/DebuggerController.h b/Source/DebuggerController.h index 55e5d20..1bc5363 100644 --- a/Source/DebuggerController.h +++ b/Source/DebuggerController.h @@ -27,16 +27,16 @@ @property(readonly) DebuggerBackEnd* connection; @property(readonly) DebuggerModel* model; -@property(retain) IBOutlet BSSourceView* sourceViewer; -@property(retain) IBOutlet NSWindow* inspector; +@property(strong) IBOutlet BSSourceView* sourceViewer; +@property(strong) IBOutlet NSWindow* inspector; -@property(retain) IBOutlet NSButton* attachedCheckbox; -@property(retain) IBOutlet NSArrayController* stackArrayController; -@property(retain) IBOutlet NSTreeController* variablesTreeController; -@property(retain) IBOutlet NSOutlineView* variablesOutlineView; +@property(strong) IBOutlet NSButton* attachedCheckbox; +@property(strong) IBOutlet NSArrayController* stackArrayController; +@property(strong) IBOutlet NSTreeController* variablesTreeController; +@property(strong) IBOutlet NSOutlineView* variablesOutlineView; -@property(retain) IBOutlet NSSegmentedControl* segmentControl; -@property(retain) IBOutlet NSTabView* tabView; +@property(strong) IBOutlet NSSegmentedControl* segmentControl; +@property(strong) IBOutlet NSTabView* tabView; - (IBAction)showInspectorWindow:(id)sender; - (IBAction)showEvalWindow:(id)sender; diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index 4cc6cfe..f7d85b4 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -80,31 +80,6 @@ return self; } -/** - * Dealloc - */ -- (void)dealloc -{ - [_connection release]; - [_model release]; - [_breakpointsController release]; - [_evalController release]; - [_expandedVariables release]; - - [_sourceViewer release]; - [_inspector release]; - - [_attachedCheckbox release]; - [_stackArrayController release]; - [_variablesTreeController release]; - [_variablesOutlineView release]; - - [_segmentControl release]; - [_tabView release]; - - [super dealloc]; -} - /** * Before the display get's comfortable, set up the NSTextView to scroll horizontally */ @@ -115,7 +90,7 @@ // Connect to XIB properties. [_sourceViewer setDelegate:self]; - [_stackArrayController setSortDescriptors:@[ [[[NSSortDescriptor alloc] initWithKey:@"index" ascending:YES] autorelease] ]]; + [_stackArrayController setSortDescriptors:@[ [[NSSortDescriptor alloc] initWithKey:@"index" ascending:YES] ]]; [_stackArrayController addObserver:self forKeyPath:@"selectedObjects" options:NSKeyValueObservingOptionNew diff --git a/Source/DebuggerModel.m b/Source/DebuggerModel.m index 442e81c..f409e83 100644 --- a/Source/DebuggerModel.m +++ b/Source/DebuggerModel.m @@ -37,14 +37,6 @@ return self; } -- (void)dealloc { - [_breakpointManager release]; - [_status release]; - [_lastError release]; - [_stack release]; - [super dealloc]; -} - - (NSUInteger)stackDepth { return self.stack.count; } diff --git a/Source/EvalController.m b/Source/EvalController.m index 3c2e7dd..5130ef2 100644 --- a/Source/EvalController.m +++ b/Source/EvalController.m @@ -29,12 +29,6 @@ return self; } -- (void)dealloc { - self.dataField = nil; - self.resultField = nil; - [super dealloc]; -} - - (IBAction)evaluateScript:(id)sender { NSString* code = [self.dataField stringValue]; [_backEnd evalScript:code callback:^(NSString* result) { diff --git a/Source/LoggingController.m b/Source/LoggingController.m index 5e1fd84..a38960d 100644 --- a/Source/LoggingController.m +++ b/Source/LoggingController.m @@ -30,12 +30,6 @@ return self; } -- (void)dealloc -{ - [logEntries_ release]; - [super dealloc]; -} - - (void)recordEntry:(LogEntry*)entry { [logEntries_ addObject:entry]; @@ -69,14 +63,6 @@ return entry; } -- (void)dealloc -{ - self.contents = nil; - self.lastWrittenTransactionID = 0; - self.lastReadTransactionID = 0; - [super dealloc]; -} - - (NSString*)directionName { return (direction_ == kLogEntryReceiving ? @"Recv" : @"Send"); diff --git a/Source/MessageQueue.m b/Source/MessageQueue.m index d5d99c9..c24f45e 100644 --- a/Source/MessageQueue.m +++ b/Source/MessageQueue.m @@ -80,21 +80,17 @@ - (void)dealloc { dispatch_sync(_dispatchQueue, ^{ [self disconnectClient]; }); - dispatch_release(_dispatchQueue); - [_messageQueue release]; - [_delegate release]; - [super dealloc]; } - (BOOL)isConnected { BOOL __block connected; - dispatch_sync(_dispatchQueue, ^{ connected = _connected; }); + dispatch_sync(_dispatchQueue, ^{ connected = self->_connected; }); return connected; } - (void)connect { dispatch_async(_dispatchQueue, ^{ - if (_connected) + if (self->_connected) return; [self openListeningSocket]; @@ -107,7 +103,7 @@ - (void)sendMessage:(NSString*)message { dispatch_async(_dispatchQueue, ^{ - [_messageQueue addObject:message]; + [self->_messageQueue addObject:message]; [self dequeueAndSend]; }); } @@ -166,7 +162,6 @@ if (_readSource) { dispatch_source_cancel(_readSource); - dispatch_release(_readSource); _readSource = NULL; } @@ -176,7 +171,6 @@ dispatch_resume(_writeSource); } dispatch_source_cancel(_writeSource); - dispatch_release(_writeSource); _writeSource = NULL; } @@ -288,7 +282,7 @@ length:partLength encoding:NSUTF8StringEncoding freeWhenDone:NO]; - [_message appendString:[bufferString autorelease]]; + [_message appendString:bufferString]; // Advance counters. _messageSize += partLength; @@ -296,7 +290,7 @@ // If this read finished the packet, handle it and reset. if (_messageSize >= _totalMessageSize) { - [_delegate messageQueue:self didReceiveMessage:[_message autorelease]]; + [_delegate messageQueue:self didReceiveMessage:_message]; _message = nil; } } diff --git a/Source/NSXMLElementAdditions.m b/Source/NSXMLElementAdditions.m index 4319a44..ab1adc3 100644 --- a/Source/NSXMLElementAdditions.m +++ b/Source/NSXMLElementAdditions.m @@ -51,9 +51,9 @@ // The value of the node is base64 encoded. if ([[[self attributeForName:@"encoding"] stringValue] isEqualToString:@"base64"]) { NSData* data = [[self stringValue] dataUsingEncoding:NSASCIIStringEncoding]; - NSData* base64Data = [[[NSData alloc] initWithBase64EncodedData:data options:0] autorelease]; + NSData* base64Data = [[NSData alloc] initWithBase64EncodedData:data options:0]; if (base64Data) { - return [[[NSString alloc] initWithData:base64Data encoding:NSUTF8StringEncoding] autorelease]; + return [[NSString alloc] initWithData:base64Data encoding:NSUTF8StringEncoding]; } else { return @"<< Failed to base64-decode data >>"; } @@ -74,7 +74,7 @@ NSMutableString* mutableString = [[NSMutableString alloc] initWithString:@"(\n"]; [self recursiveBase64DecodedValue:mutableString depth:1]; [mutableString appendString:@")"]; - return [mutableString autorelease]; + return mutableString; } return [self internalBase64DecodedValue]; diff --git a/Source/PreferencesController.m b/Source/PreferencesController.m index 507e38f..00ded80 100644 --- a/Source/PreferencesController.m +++ b/Source/PreferencesController.m @@ -38,15 +38,6 @@ NSSize pathsSize; return self; } -/** - * Destructor - */ -- (void)dealloc -{ - [blankView release]; - [super dealloc]; -} - /** * Awake from nib */ diff --git a/Source/ProtocolClient.m b/Source/ProtocolClient.m index bddd34d..537906e 100644 --- a/Source/ProtocolClient.m +++ b/Source/ProtocolClient.m @@ -47,11 +47,6 @@ return self; } -- (void)dealloc { - [_dispatchTable release]; - [super dealloc]; -} - - (BOOL)isConnected { return [_messageQueue isConnected]; } @@ -85,10 +80,10 @@ va_end(args); int transaction = _nextID++; - NSString* taggedCommand = [NSString stringWithFormat:@"%@ -i %d", [command autorelease], transaction]; + NSString* taggedCommand = [NSString stringWithFormat:@"%@ -i %d", command, transaction]; assert(_messageQueue); - [_dispatchTable setObject:[[handler copy] autorelease] forKey:@(transaction)]; + [_dispatchTable setObject:[handler copy] forKey:@(transaction)]; [_messageQueue sendMessage:taggedCommand]; } @@ -97,7 +92,7 @@ // Collect varargs and format command. va_list args; va_start(args, handler); - NSString* command = [[[NSString alloc] initWithFormat:format arguments:args] autorelease]; + NSString* command = [[NSString alloc] initWithFormat:format arguments:args]; va_end(args); int transaction = _nextID++; @@ -106,7 +101,7 @@ withString:[NSString stringWithFormat:@"%d", transaction]]; assert(_messageQueue); - [_dispatchTable setObject:[[handler copy] autorelease] forKey:@(transaction)]; + [_dispatchTable setObject:[handler copy] forKey:@(transaction)]; [_messageQueue sendMessage:taggedCommand]; } @@ -157,7 +152,6 @@ } - (void)messageQueueDidDisconnect:(MessageQueue*)queue { - [_messageQueue release]; _messageQueue = nil; [_dispatchTable removeAllObjects]; [_delegate debuggerEngineDisconnected:self]; @@ -172,7 +166,7 @@ LogEntry* entry = [LogEntry newSendEntry:message]; entry.lastReadTransactionID = _lastReadID; entry.lastWrittenTransactionID = _lastWrittenID; - [logger recordEntry:[entry autorelease]]; + [logger recordEntry:entry]; } // Callback with the message content when one has been receieved. @@ -182,13 +176,13 @@ LogEntry* entry = [LogEntry newReceiveEntry:message]; entry.lastReadTransactionID = _lastReadID; entry.lastWrittenTransactionID = _lastWrittenID; - [logger recordEntry:[entry autorelease]]; + [logger recordEntry:entry]; // Parse the XML and test for errors. NSError* error = nil; - NSXMLDocument* xml = [[[NSXMLDocument alloc] initWithXMLString:message - options:NSXMLDocumentTidyXML - error:&error] autorelease]; + NSXMLDocument* xml = [[NSXMLDocument alloc] initWithXMLString:message + options:NSXMLDocumentTidyXML + error:&error]; if (error) { [self messageQueue:queue error:error]; return; diff --git a/Source/StackFrame.m b/Source/StackFrame.m index 49be5c2..24550c1 100644 --- a/Source/StackFrame.m +++ b/Source/StackFrame.m @@ -18,14 +18,6 @@ @implementation StackFrame -- (void)dealloc { - self.filename = nil; - self.source = nil; - self.function = nil; - self.variables = nil; - [super dealloc]; -} - - (BOOL)isEqual:(id)object { if (![object isKindOfClass:[StackFrame class]]) return NO; diff --git a/Source/Tests/DebuggerModelTest.m b/Source/Tests/DebuggerModelTest.m index 1428d47..4ff9d89 100644 --- a/Source/Tests/DebuggerModelTest.m +++ b/Source/Tests/DebuggerModelTest.m @@ -33,7 +33,6 @@ } - (void)tearDown { - [_model release]; [super tearDown]; } @@ -44,7 +43,7 @@ - (StackFrame*)makeStackFrameForFile:(NSString*)file atLine:(NSUInteger)line stackIndex:(NSUInteger)index { - StackFrame* frame = [[[StackFrame alloc] init] autorelease]; + StackFrame* frame = [[StackFrame alloc] init]; frame.filename = file; frame.lineNumber = line; frame.index = index; diff --git a/Source/VariableNode.m b/Source/VariableNode.m index 5cc17da..97d0e43 100644 --- a/Source/VariableNode.m +++ b/Source/VariableNode.m @@ -39,17 +39,6 @@ return self; } -- (void)dealloc { - [_name release]; - [_fullName release]; - [_className release]; - [_type release]; - [_value release]; - [_children release]; - [_address release]; - [super dealloc]; -} - - (void)setChildrenFromXMLChildren:(NSArray*)children { [self willChangeValueForKey:@"children"]; @@ -63,7 +52,6 @@ // elsewhere. if (![node.name isEqualToString:@"CLASSNAME"]) [_children addObject:node]; - [node release]; } } -- 2.43.5