diff --git a/Audio/AudioPlayer.m b/Audio/AudioPlayer.m index fbea597ee..58c66acaa 100644 --- a/Audio/AudioPlayer.m +++ b/Audio/AudioPlayer.m @@ -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]; diff --git a/Audio/Chain/BufferChain.m b/Audio/Chain/BufferChain.m index 8ee67dc12..97f1c21fa 100644 --- a/Audio/Chain/BufferChain.m +++ b/Audio/Chain/BufferChain.m @@ -105,9 +105,12 @@ - (void)dealloc { [userInfo release]; + [streamURL release]; [inputNode release]; [converterNode release]; + + NSLog(@"Bufferchain dealloc"); [super dealloc]; } diff --git a/Audio/Chain/ConverterNode.m b/Audio/Chain/ConverterNode.m index 89c183ebc..f9998bba6 100644 --- a/Audio/Chain/ConverterNode.m +++ b/Audio/Chain/ConverterNode.m @@ -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 diff --git a/Audio/Chain/InputNode.m b/Audio/Chain/InputNode.m index d91ec0fac..68ae34bb8 100644 --- a/Audio/Chain/InputNode.m +++ b/Audio/Chain/InputNode.m @@ -151,7 +151,7 @@ - (void)dealloc { - NSLog(@"DEALLOCATING"); + NSLog(@"Input Node dealloc"); [decoder removeObserver:self forKeyPath:@"properties"]; [decoder removeObserver:self forKeyPath:@"metadata"]; diff --git a/Audio/Chain/Node.m b/Audio/Chain/Node.m index d3bde5a89..e77e6d5ce 100644 --- a/Audio/Chain/Node.m +++ b/Audio/Chain/Node.m @@ -219,4 +219,14 @@ } +- (void)dealloc +{ + [buffer release]; + [semaphore release]; + [readLock release]; + [writeLock release]; + + [super dealloc]; +} + @end diff --git a/Audio/Output/OutputCoreAudio.m b/Audio/Output/OutputCoreAudio.m index ab0503fd3..0a4fecd01 100644 --- a/Audio/Output/OutputCoreAudio.m +++ b/Audio/Output/OutputCoreAudio.m @@ -234,6 +234,8 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc - (void)dealloc { [self stop]; + + [[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.outputDevice"]; [super dealloc]; } diff --git a/AudioScrobbler/AudioScrobbler.m b/AudioScrobbler/AudioScrobbler.m index f4a543c24..c24c0b631 100644 --- a/AudioScrobbler/AudioScrobbler.m +++ b/AudioScrobbler/AudioScrobbler.m @@ -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]) { diff --git a/Playlist/IndexFormatter.m b/Playlist/IndexFormatter.m index dd536232f..46b53e9ab 100644 --- a/Playlist/IndexFormatter.m +++ b/Playlist/IndexFormatter.m @@ -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 diff --git a/Playlist/SecondsFormatter.m b/Playlist/SecondsFormatter.m index d04e69f7b..df767df75 100644 --- a/Playlist/SecondsFormatter.m +++ b/Playlist/SecondsFormatter.m @@ -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 diff --git a/Plugins/FileSource/FileSource.m b/Plugins/FileSource/FileSource.m index 95c71054c..1d838678b 100644 --- a/Plugins/FileSource/FileSource.m +++ b/Plugins/FileSource/FileSource.m @@ -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 diff --git a/Plugins/HTTPSource/HTTPSource.m b/Plugins/HTTPSource/HTTPSource.m index 65d9a88b1..0a49084d4 100644 --- a/Plugins/HTTPSource/HTTPSource.m +++ b/Plugins/HTTPSource/HTTPSource.m @@ -117,6 +117,8 @@ - (void)dealloc { + [self setURL:nil]; + [_socket release]; [_url release]; diff --git a/Plugins/MAD/MADDecoder.m b/Plugins/MAD/MADDecoder.m index 9456f6c83..a35151381 100644 --- a/Plugins/MAD/MADDecoder.m +++ b/Plugins/MAD/MADDecoder.m @@ -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; diff --git a/Plugins/Vorbis/VorbisDecoder.m b/Plugins/Vorbis/VorbisDecoder.m index 7ef16c183..61752dd03 100644 --- a/Plugins/Vorbis/VorbisDecoder.m +++ b/Plugins/Vorbis/VorbisDecoder.m @@ -112,6 +112,8 @@ long sourceTell(void *datasource) - (void)close { ov_clear(&vorbisRef); + + [source close]; [source release]; }