• 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
Re: AUEffectBase::ChangeStreamFormat changes sOld
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AUEffectBase::ChangeStreamFormat changes sOld


  • Subject: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • From: kelly jacklin <email@hidden>
  • Date: Wed, 29 Sep 2004 05:39:08 -0700

On Sep 29, 2004, at 5:25 AM, Shai Shasag wrote:

Thanks for the (very) fast answer.
I used a copy of sOld and now things work.

However the current design is very confusing.

I agree: I stumbled on this very same issue quite some time ago, for the same reasons you have, and reported it when I did. I believe that this actually has been fixed in some later version of the SDK. Are you sure you are running with the latest version?


1st, If sOld refers to the current format, and I can get the current format by calling GetStreamFormat, why pass it to ChangeStreamFormat at all?

As a convenience.

2nd, if sOld is passed anyway, probably so I can easily compare it to sNew, why not pass a copy? Clearly I cannot use sOld as it is now.

That is, in fact, the change I suggested.

Are there any other places in the AU SDK with similar problem, that I should look out for?

This issue is _not_ unique to the AU SDK. Any time you are passed a reference to a data structure, you must be aware that the underlying data structure can (and often will) change underneath you while you are making calls back into the code that owns the object. Indeed, even if you do not call into the owning code, the data structure can change (perhaps on another thread or completion callback, etc.). Having a const reference does _not_ make it legal for you to assume that the data structure will not change; there are no copy-on-write semantics in C++...


I have not come across any other issues like this in the AU SDK, but they may very well exist, as this is perfectly legal, albeit confusing, use of a C++ construct. Your best bet is to code defensively.

kelly jacklin

_______________________________________________
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


  • Follow-Ups:
    • Re: AUEffectBase::ChangeStreamFormat changes sOld
      • From: kelly jacklin <email@hidden>
References: 
 >AUEffectBase::ChangeStreamFormat changes sOld (From: Shai Shasag <email@hidden>)
 >Re: AUEffectBase::ChangeStreamFormat changes sOld (From: kelly jacklin <email@hidden>)
 >Re: AUEffectBase::ChangeStreamFormat changes sOld (From: Shai Shasag <email@hidden>)

  • Prev by Date: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • Next by Date: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • Previous by thread: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • Next by thread: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • Index(es):
    • Date
    • Thread