mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Clean up object deallocation code
This commit is contained in:
@@ -425,10 +425,7 @@ typedef struct
|
||||
fontContainerRef = 0;
|
||||
}
|
||||
|
||||
// TODO: Is this a correct way of releasing the MMAppController?
|
||||
// (It doesn't seem like dealloc is ever called.)
|
||||
[NSApp setDelegate:nil];
|
||||
[self autorelease];
|
||||
}
|
||||
|
||||
- (void)removeVimController:(id)controller
|
||||
|
||||
@@ -76,8 +76,8 @@ static int numFullscreenWindows = 0;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[target release];
|
||||
[view release];
|
||||
[target release]; target = nil;
|
||||
[view release]; view = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+20
-20
@@ -91,18 +91,18 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
rowCache = NULL;
|
||||
}
|
||||
#endif
|
||||
[emptyRowString release];
|
||||
[boldItalicFontWide release];
|
||||
[italicFontWide release];
|
||||
[boldFontWide release];
|
||||
[fontWide release];
|
||||
[boldItalicFont release];
|
||||
[italicFont release];
|
||||
[boldFont release];
|
||||
[font release];
|
||||
[defaultBackgroundColor release];
|
||||
[defaultForegroundColor release];
|
||||
[attribString release];
|
||||
[emptyRowString release]; emptyRowString = nil;
|
||||
[boldItalicFontWide release]; boldItalicFontWide = nil;
|
||||
[italicFontWide release]; italicFontWide = nil;
|
||||
[boldFontWide release]; boldFontWide = nil;
|
||||
[fontWide release]; fontWide = nil;
|
||||
[boldItalicFont release]; boldItalicFont = nil;
|
||||
[italicFont release]; italicFont = nil;
|
||||
[boldFont release]; boldFont = nil;
|
||||
[font release]; font = nil;
|
||||
[defaultBackgroundColor release]; defaultBackgroundColor = nil;
|
||||
[defaultForegroundColor release]; defaultForegroundColor = nil;
|
||||
[attribString release]; attribString = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -631,10 +631,10 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
- (void)setFont:(NSFont*)newFont
|
||||
{
|
||||
if (newFont && font != newFont) {
|
||||
[boldItalicFont release];
|
||||
[italicFont release];
|
||||
[boldFont release];
|
||||
[font release];
|
||||
[boldItalicFont release]; boldItalicFont = nil;
|
||||
[italicFont release]; italicFont = nil;
|
||||
[boldFont release]; boldFont = nil;
|
||||
[font release]; font = nil;
|
||||
|
||||
// NOTE! When setting a new font we make sure that the advancement of
|
||||
// each glyph is fixed.
|
||||
@@ -696,10 +696,10 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
// very well include wide characters.)
|
||||
if (font) [self setWideFont:font];
|
||||
} else if (newFont != fontWide) {
|
||||
[boldItalicFontWide release];
|
||||
[italicFontWide release];
|
||||
[boldFontWide release];
|
||||
[fontWide release];
|
||||
[boldItalicFontWide release]; boldItalicFontWide = nil;
|
||||
[italicFontWide release]; italicFontWide = nil;
|
||||
[boldFontWide release]; boldFontWide = nil;
|
||||
[fontWide release]; fontWide = nil;
|
||||
|
||||
float pointSize = [newFont pointSize];
|
||||
NSFontDescriptor *desc = [newFont fontDescriptor];
|
||||
|
||||
@@ -98,8 +98,8 @@ enum {
|
||||
|
||||
// The text storage retains the layout manager which in turn retains
|
||||
// the text container.
|
||||
[tc release];
|
||||
[lm release];
|
||||
[tc autorelease];
|
||||
[lm autorelease];
|
||||
|
||||
// NOTE: This will make the text storage the principal owner of the text
|
||||
// system. Releasing the text storage will in turn release the layout
|
||||
@@ -129,7 +129,7 @@ enum {
|
||||
markedTextField = nil;
|
||||
}
|
||||
|
||||
[lastMouseDownEvent release];
|
||||
[lastMouseDownEvent release]; lastMouseDownEvent = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -249,10 +249,8 @@ enum {
|
||||
int flags = *((int*)bytes); bytes += sizeof(int);
|
||||
int len = *((int*)bytes); bytes += sizeof(int);
|
||||
NSString *string = [[NSString alloc]
|
||||
initWithBytesNoCopy:(void*)bytes
|
||||
length:len
|
||||
encoding:NSUTF8StringEncoding
|
||||
freeWhenDone:NO];
|
||||
initWithBytes:(void*)bytes length:len
|
||||
encoding:NSUTF8StringEncoding];
|
||||
bytes += len;
|
||||
|
||||
#if MM_DEBUG_DRAWING
|
||||
@@ -703,6 +701,9 @@ enum {
|
||||
[markedTextField setBezeled:NO];
|
||||
[markedTextField setBordered:YES];
|
||||
|
||||
// NOTE: The panel that holds the marked text field is allocated here
|
||||
// and released in dealloc. No pointer to the panel is kept, instead
|
||||
// [markedTextField window] is used to access the panel.
|
||||
NSPanel *panel = [[NSPanel alloc]
|
||||
initWithContentRect:cellRect
|
||||
styleMask:NSBorderlessWindowMask|NSUtilityWindowMask
|
||||
|
||||
@@ -833,10 +833,8 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
const void *bytes = [data bytes];
|
||||
int len = *((int*)bytes); bytes += sizeof(int);
|
||||
NSString *actionName = [[NSString alloc]
|
||||
initWithBytesNoCopy:(void*)bytes
|
||||
length:len
|
||||
encoding:NSUTF8StringEncoding
|
||||
freeWhenDone:NO];
|
||||
initWithBytes:(void*)bytes length:len
|
||||
encoding:NSUTF8StringEncoding];
|
||||
|
||||
SEL sel = NSSelectorFromString(actionName);
|
||||
[NSApp sendAction:sel to:nil from:self];
|
||||
@@ -848,10 +846,8 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
int col = *((int*)bytes); bytes += sizeof(int);
|
||||
int len = *((int*)bytes); bytes += sizeof(int);
|
||||
NSString *title = [[NSString alloc]
|
||||
initWithBytesNoCopy:(void*)bytes
|
||||
length:len
|
||||
encoding:NSUTF8StringEncoding
|
||||
freeWhenDone:NO];
|
||||
initWithBytes:(void*)bytes length:len
|
||||
encoding:NSUTF8StringEncoding];
|
||||
|
||||
NSMenu *menu = [self topLevelMenuForTitle:title];
|
||||
if (menu) {
|
||||
@@ -1222,7 +1218,7 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
@implementation MMAlert
|
||||
- (void)dealloc
|
||||
{
|
||||
[textField release];
|
||||
[textField release]; textField = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@@ -287,10 +287,8 @@ enum {
|
||||
int length = *((int*)p); p += sizeof(int);
|
||||
|
||||
NSString *label = [[NSString alloc]
|
||||
initWithBytesNoCopy:(void*)p
|
||||
length:length
|
||||
encoding:NSUTF8StringEncoding
|
||||
freeWhenDone:NO];
|
||||
initWithBytes:(void*)p length:length
|
||||
encoding:NSUTF8StringEncoding];
|
||||
p += length;
|
||||
|
||||
// Set the label of the tab; add a new tab when needed.
|
||||
@@ -356,7 +354,7 @@ enum {
|
||||
[[self tabView] addTabViewItem:tvi];
|
||||
vimTaskSelectedTab = NO;
|
||||
|
||||
[tvi release];
|
||||
[tvi autorelease];
|
||||
|
||||
return tvi;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
defer:flag];
|
||||
if (!self) return nil;
|
||||
|
||||
[self setReleasedWhenClosed:NO];
|
||||
|
||||
NSRect tabSepRect = { 0, rect.size.height - 1, rect.size.width, 1 };
|
||||
tablineSeparator = [[NSBox alloc] initWithFrame:tabSepRect];
|
||||
|
||||
@@ -61,7 +63,8 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[tablineSeparator removeFromSuperviewWithoutNeedingDisplay];
|
||||
// TODO: Is there any reason why we would want the following call?
|
||||
//[tablineSeparator removeFromSuperviewWithoutNeedingDisplay];
|
||||
[tablineSeparator release]; tablineSeparator = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user