Adium

Changeset 22704

Show
Ignore:
Timestamp:
02/26/2008 09:46:03 PM (9 months ago)
Author:
evands
Message:

When the system output device changes, be sure to make changes to our QTMovie objects on the main thread rather than on whatever thread receives the notification. This should fix #9299

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/AdiumSound.m

    r22418 r22704  
    307307} 
    308308 
    309 @end 
    310  
    311 static OSStatus systemOutputDeviceDidChange(AudioHardwarePropertyID property, void *refcon) 
    312 
    313 #pragma unused(property) 
    314         NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
    315  
    316         AdiumSound *self = (id)refcon; 
    317         NSCAssert1(self, @"AudioHardware property listener function %s called with nil refcon, which we expected to be the AdiumSound instance", __PRETTY_FUNCTION__); 
    318  
    319         NSEnumerator *soundsEnum = [[self allSounds] objectEnumerator]; 
    320         QTMovie *movie; 
     309- (void)systemOutputDeviceDidChange 
     310
     311        NSEnumerator    *soundsEnum = [[self allSounds] objectEnumerator]; 
     312        QTMovie                 *movie; 
     313 
    321314        while ((movie = [soundsEnum nextObject])) { 
    322315                //QTMovie gets confused if we're playing when we do this, so pause momentarily. 
     
    340333                [movie setRate:savedRate]; 
    341334        } 
    342  
     335
     336 
     337@end 
     338 
     339static OSStatus systemOutputDeviceDidChange(AudioHardwarePropertyID property, void *refcon) 
     340
     341#pragma unused(property) 
     342        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
     343 
     344        AdiumSound *self = (id)refcon; 
     345        NSCAssert1(self, @"AudioHardware property listener function %s called with nil refcon, which we expected to be the AdiumSound instance", __PRETTY_FUNCTION__); 
     346 
     347        [self performSelectorOnMainThread:@selector(systemOutputDeviceDidChange) 
     348                                                   withObject:nil 
     349                                                waitUntilDone:NO]; 
    343350        [pool release]; 
    344          
     351 
    345352        return noErr; 
    346353}