Index: trunk/ChameleonPrefPane/Sources/RoundedBox.m =================================================================== --- trunk/ChameleonPrefPane/Sources/RoundedBox.m (revision 366) +++ trunk/ChameleonPrefPane/Sources/RoundedBox.m (revision 367) @@ -100,8 +100,7 @@ // Construct rounded rect path NSRect boxRect = [self bounds]; - NSRect bgRect = boxRect; - bgRect = NSInsetRect(boxRect, borderWidth / 2.0, borderWidth / 2.0); + NSRect bgRect = NSInsetRect(boxRect, borderWidth / 2.0, borderWidth / 2.0); bgRect = NSIntegralRect(bgRect); bgRect.origin.x += 0.5; bgRect.origin.y += 0.5; Index: trunk/ChameleonPrefPane/Sources/PartitionInfoElement.h =================================================================== --- trunk/ChameleonPrefPane/Sources/PartitionInfoElement.h (revision 366) +++ trunk/ChameleonPrefPane/Sources/PartitionInfoElement.h (revision 367) @@ -39,6 +39,7 @@ -(id) initWithBSDName: (NSString*) bsdName; -(id) initWithBSDName: (NSString*) bsdName withinSession: (DASessionRef) session; +-(void) cleanup; -(int) extractInfoWithBSDName: (NSString*) bsdName; -(int) extractInfoWithBSDName: (NSString*) bsdName withinSession:(DASessionRef) session; @@ -61,4 +62,5 @@ -(bool) isBootable; -(int) imageIndexFromFs; +(NSString*) removesSpacesFromLabel:(NSString*) label; + @end Index: trunk/ChameleonPrefPane/Sources/PartitionInfoElement.mm =================================================================== --- trunk/ChameleonPrefPane/Sources/PartitionInfoElement.mm (revision 366) +++ trunk/ChameleonPrefPane/Sources/PartitionInfoElement.mm (revision 367) @@ -89,10 +89,13 @@ /// Extract a particular information from the disk partition dictionary from a key, generate a string value output -(NSString*) createStringValueWithKey: (NSString*) key { - if (err) return @""; - CFTypeRef o = [descDict objectForKey: key]; - if (o==nil) return @""; - return (NSString*) CFStringCreateWithFormat(NULL, NULL, CFSTR("%@"), o); + if (err) return @""; + CFTypeRef o = [descDict objectForKey: key]; + if (o==nil) return @""; + CFStringRef sref = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@"), o); + NSString* s = [[((NSString*) sref) copy] autorelease]; + CFRelease(sref); + return s; } /// main extraction method create a dictionary containing all needed information from disk arbitration API @@ -140,16 +143,22 @@ if (disk == NULL) err = EINVAL; } + [self cleanup]; + if (err == 0) { - descDict = (NSDictionary*) DADiskCopyDescription(disk); - [descDict retain]; - - if (descDict == NULL) err = EINVAL; + CFDictionaryRef dr = DADiskCopyDescription(disk); + if (dr!=NULL) + { + self.descDict = [((NSDictionary*) dr) copy]; + CFRelease(dr); + if (self.descDict == NULL) err = EINVAL; + } } if (err == 0) { self.vUUID = [self createStringValueWithKey: @"DAVolumeUUID"]; self.vName = [self createStringValueWithKey: @"DAVolumeName"]; + self.vAliasName = self.vName; // by default renamed = original part name self.vKind = [self createStringValueWithKey: @"DAVolumeKind"]; self.mediaPath = [self createStringValueWithKey: @"DAMediaPath"]; self.devProtocol = [self createStringValueWithKey: @"DADeviceProtocol"]; @@ -157,7 +166,6 @@ devInternal = (bool) [[descDict objectForKey: @"DADeviceInternal"] boolValue]; mediaRemovable = (bool) [[descDict objectForKey: @"DAMediaRemovable"] boolValue]; - self.vAliasName = self.vName; // by default renamed = original part name } // Clean up. @@ -192,7 +200,7 @@ } if (session!=nil) CFRelease(session); } - + [partArr release]; return arr; } @@ -280,18 +288,25 @@ return self; } -/// release created objects --(void) dealloc +-(void) cleanup { - if (descDict != nil) [descDict release]; + + if (descDict != nil) CFRelease(descDict); if (bsdName != nil) [bsdName release]; if (vUUID != nil) [vUUID release]; if (vKind != nil) [vKind release]; if (vName != nil) [vName release]; if (mediaPath != nil) [mediaPath release]; + if (devProtocol != nil) [devProtocol release]; + if (vAliasName != nil) [vAliasName release]; + bsdName = vUUID = vKind = vName = mediaPath = devProtocol = vAliasName = nil; + descDict = nil; +} - if (vAliasName != nil) [vAliasName release]; - +/// release created objects +-(void) dealloc +{ + [self cleanup]; [super dealloc]; }