Cleaned up memory leaks.

CQTexperiment
vspader 2007-10-13 07:09:46 +00:00
parent 6f6b01b15c
commit 97a278a143
13 changed files with 61 additions and 6 deletions

View File

@ -253,6 +253,8 @@
- (void)endOfInputPlayed
{
[bufferChain release];
if ([chainQueue count] <= 0)
{
//End of playlist
@ -260,7 +262,6 @@
return;
}
[bufferChain release];
bufferChain = [chainQueue objectAtIndex:0];
[bufferChain retain];

View File

@ -105,10 +105,13 @@
- (void)dealloc
{
[userInfo release];
[streamURL release];
[inputNode release];
[converterNode release];
NSLog(@"Bufferchain dealloc");
[super dealloc];
}

View File

@ -140,6 +140,14 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
return YES;
}
- (void)dealloc
{
NSLog(@"Decoder dealloc");
[self cleanUp];
[super dealloc];
}
- (void)setOutputFormat:(AudioStreamBasicDescription)format
{
NSLog(@"SETTING OUTPUT FORMAT!");
@ -160,6 +168,9 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
AudioConverterDispose(converter);
converter = NULL;
}
if (callbackBuffer) {
free(callbackBuffer);
}
}
@end

View File

@ -151,7 +151,7 @@
- (void)dealloc
{
NSLog(@"DEALLOCATING");
NSLog(@"Input Node dealloc");
[decoder removeObserver:self forKeyPath:@"properties"];
[decoder removeObserver:self forKeyPath:@"metadata"];

View File

@ -219,4 +219,14 @@
}
- (void)dealloc
{
[buffer release];
[semaphore release];
[readLock release];
[writeLock release];
[super dealloc];
}
@end

View File

@ -235,6 +235,8 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
{
[self stop];
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.outputDevice"];
[super dealloc];
}

View File

@ -192,7 +192,7 @@ escapeForLastFM(NSString *string)
- (void) processAudioScrobblerCommands:(AudioScrobbler *)myself
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSAutoreleasePool *pool = nil;
AudioScrobblerClient *client = [[AudioScrobblerClient alloc] init];
mach_timespec_t timeout = { 5, 0 };
NSEnumerator *enumerator = nil;
@ -201,6 +201,9 @@ escapeForLastFM(NSString *string)
in_port_t port = 33367;
while([myself keepProcessingAudioScrobblerCommands]) {
if (pool)
[pool release];
pool = [[NSAutoreleasePool alloc] init];
// Get the first command to be sent
@synchronized([myself queue]) {
@ -235,6 +238,8 @@ escapeForLastFM(NSString *string)
semaphore_timedwait([myself semaphore], timeout);
}
[pool release];
// Send a final stop command to cleanup
@try {
if([client connectToHost:@"localhost" port:port]) {

View File

@ -24,7 +24,7 @@
result = [NSString stringWithFormat:@"%i", value];
return [[result retain] autorelease];
return result;
}
- (BOOL) getObjectValue:(id *)object forString:(NSString *)string errorDescription:(NSString **)error

View File

@ -63,7 +63,7 @@
result = [NSString stringWithFormat:@"0:%.2u", seconds];
}
return [[result retain] autorelease];
return result;
}
- (BOOL) getObjectValue:(id *)object forString:(NSString *)string errorDescription:(NSString **)error

View File

@ -52,6 +52,8 @@
- (void)close
{
[self setURL:nil];
fclose(_fd);
}
@ -73,4 +75,10 @@
return [NSArray arrayWithObject:@"file"];
}
- (void)dealloc {
NSLog(@"DEALLOCATING SOURCE");
[super dealloc];
}
@end

View File

@ -117,6 +117,8 @@
- (void)dealloc
{
[self setURL:nil];
[_socket release];
[_url release];

View File

@ -548,13 +548,24 @@ static inline signed int scale (mad_fixed_t sample)
- (void)close
{
[_source close];
if (_source)
{
[_source close];
[_source release];
_source = nil;
}
mad_synth_finish(&_synth);
mad_frame_finish(&_frame);
mad_stream_finish(&_stream);
}
- (void)dealloc
{
NSLog(@"Decoder dealloc");
[super dealloc];
}
- (double)seekToTime:(double)milliseconds
{
unsigned long new_position;

View File

@ -112,6 +112,8 @@ long sourceTell(void *datasource)
- (void)close
{
ov_clear(&vorbisRef);
[source close];
[source release];
}