Leaks fixes

This commit is contained in:
Airy ANDRE 2012-02-07 18:12:16 +01:00
parent 6095f69279
commit 30c8d41736
3 changed files with 38 additions and 22 deletions

View File

@ -121,6 +121,8 @@ NSString* NSImageCompressionFactor = @"NSImageCompressionFactor";
if(imageRep!=nil)
[result addObject:imageRep];
[imageRep release];
}
CFRelease(imageSource);
@ -370,10 +372,11 @@ NSString* NSImageCompressionFactor = @"NSImageCompressionFactor";
if(_bitmapPlanes[i]!=NULL)
NSZoneFree(NULL,_bitmapPlanes[i]);
NSZoneFree(NULL,_bitmapPlanes);
}
}
if(_bitmapPlanes!=NULL){
NSZoneFree(NULL,_bitmapPlanes);
}
CGImageRelease(_cgImage);
[super dealloc];
}
@ -584,6 +587,7 @@ NSString* NSImageCompressionFactor = @"NSImageCompressionFactor";
if ([properties count]) {
id compressionFactor = [properties valueForKey:NSImageCompressionFactor];
if (compressionFactor) {
CGProperties = [NSMutableDictionary dictionary];
[CGProperties setValue:compressionFactor forKey:(id)kCGImageDestinationLossyCompressionQuality];
}
}

View File

@ -94,9 +94,11 @@
_fileOwner=[[keyed decodeObjectForKey:@"NSRoot"] retain];
if([_fileOwner isKindOfClass:[NSCustomObject class]]) {
id formerFileOwner = [_fileOwner autorelease];
_fileOwner = [owner retain];
[keyed replaceObject:formerFileOwner withObject:_fileOwner];
if (_fileOwner != owner) {
id formerFileOwner = [_fileOwner autorelease];
_fileOwner = [owner retain];
[keyed replaceObject:formerFileOwner withObject:_fileOwner];
}
}
_accessibilityConnectors=[[keyed decodeObjectForKey:@"NSAccessibilityConnectors"] retain];
@ -108,11 +110,10 @@
_fontManager=[[keyed decodeObjectForKey:@"NSFontManager"] retain];
_framework=[[keyed decodeObjectForKey:@"NSFramework"] retain];
_nextOid=[keyed decodeIntForKey:@"NSNextOid"];
_objectsKeys=[[keyed decodeObjectForKey:@"NSObjectsKeys"] mutableCopy];
_objectsValues=[[keyed decodeObjectForKey:@"NSObjectsValues"] mutableCopy];
_objectsKeys=[[keyed decodeObjectForKey:@"NSObjectsKeys"] retain];
_objectsValues=[[keyed decodeObjectForKey:@"NSObjectsValues"] retain];
_oidKeys=[[keyed decodeObjectForKey:@"NSOidsKeys"] retain];
_oidValues=[[keyed decodeObjectForKey:@"NSOidsValues"] retain];
_fileOwner=[[keyed decodeObjectForKey:@"NSRoot"] retain];
_visibleWindows=[[keyed decodeObjectForKey:@"NSVisibleWindows"] retain];
@ -127,6 +128,11 @@
[keyed replaceObject:aKey withObject:replacement];
// Update the connections
[self replaceObject:aKey withObject:replacement];
if (![_objectsKeys isKindOfClass:[NSMutableArray class]]) {
[_objectsKeys autorelease];
_objectsKeys = [_objectsKeys mutableCopy];
}
[(NSMutableArray *)_objectsKeys replaceObjectAtIndex:i withObject:replacement];
[replacement release];
}
@ -198,20 +204,20 @@
-(void)buildConnectionsWithNameTable:(NSDictionary *)nameTable {
id owner=[nameTable objectForKey:NSNibOwner];
[self replaceObject:_fileOwner withObject:owner];
id formerOwner = [_fileOwner autorelease];
_fileOwner=[owner retain];
[_objectsKeys autorelease];
_objectsKeys = [_objectsKeys mutableCopy];
[_objectsValues autorelease];
_objectsValues = [_objectsValues mutableCopy];
for(int i = [_objectsValues count] - 1; i >= 0; i--){
id aValue = [_objectsValues objectAtIndex:i];
if (aValue == formerOwner) {
[(NSMutableArray *)_objectsValues replaceObjectAtIndex:i withObject:_fileOwner];
if (_fileOwner != owner) {
[self replaceObject:_fileOwner withObject:owner];
id formerOwner = [_fileOwner autorelease];
_fileOwner=[owner retain];
if (![_objectsValues isKindOfClass:[NSMutableArray class]]) {
[_objectsValues autorelease];
_objectsValues = [_objectsValues mutableCopy];
}
for(int i = [_objectsValues count] - 1; i >= 0; i--){
id aValue = [_objectsValues objectAtIndex:i];
if (aValue == formerOwner) {
[(NSMutableArray *)_objectsValues replaceObjectAtIndex:i withObject:_fileOwner];
}
}
}
[self establishConnections];

View File

@ -11,6 +11,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/NSView.h>
@implementation NSNibHelpConnector
- (void)dealloc
{
[_file release];
[_marker release];
[super dealloc];
}
-file {
return _file;