• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
The reason behind crash in AVAudioPlayer finishedPlaying after upgrade to iPhone 3.0 OS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The reason behind crash in AVAudioPlayer finishedPlaying after upgrade to iPhone 3.0 OS


  • Subject: The reason behind crash in AVAudioPlayer finishedPlaying after upgrade to iPhone 3.0 OS
  • From: Mo DeJong <email@hidden>
  • Date: Fri, 14 Aug 2009 14:06:10 -0700

Hi all

In testing my app under iPhone OS 3.0, I found that it was crashing in
[AVAudioPlayer finishedPlaying] and it was difficult to track down
exactly why. So, I though I would post this note in case other
developers run into this issue.

My code was creating a AVAudioPlayer with a custom delegate, it worked
fine in 2.X but after an upgrade to 3.0 I was getting strange crashes
like so:

OS Version:      iPhone OS 3.0.1 (7A400)

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xa1b1c1db
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                     0x30011940 objc_msgSend + 20
1   AVFoundation                        0x355bb508
-[AVAudioPlayer(AVAudioPlayerPriv) finishedPlaying] + 220
2   CoreFoundation                      0x3025af5a -[NSObject
performSelector:withObject:] + 18

The cause of this problem was that the AVAudioPlayer object was trying
to invoke [avAudioPlayer.delegate audioPlayerDidFinishPlaying] but the
avAudioPlayer.delegate ref was no longer valid because it had been
deallocated when releasing the avAudioPlayer in my code. The root of
the issue was that the ref count of avAudioPlayer.delegate seems to
have been incremented in OS 2.X, but it is not incremented in OS 3.0.
The documentation states that the delegate is an assign and not a
retain, so it seems that the 3.0 implementation is more in line with
the documentation. Explicitly holding a ref to the delegate fixed the
problem. I hope that helps someone avoid wasting a day poking around
in gdb.

Mo DeJong
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: RE: Les Paul, you will be missed!
  • Next by Date: Re: Wrapper class for Cocoa Audio Units in Carbon Hosts
  • Previous by thread: Using MallocDebug with Audio Units
  • Next by thread: kAudioUnitID_DLSSynth and Snow Leopard
  • Index(es):
    • Date
    • Thread