[Insight-developers] Re: LightObject race condition fix

Dan Mueller dan.muel at gmail.com
Tue Aug 7 16:09:43 EDT 2007


On 07/08/07, Steve M. Robbins <steve at sumost.ca> wrote:
> Developers: what is the use-case for SetReferenceCount()?

I know I use SetReferenceCount(): I have cases (to do with wrapping
for .NET) where I do not know how many calls to Register() have gone
before, but I do know when the object can be released. At that point I
call SetReferenceCount(0) to force the pointer to be freed.

This is due to (one of many) limitations of C++/CLI: managed classes
can not contain a SmartPointer to keep the reference alive, only a *
pointer. Removing SetReferenceCount() without adding a mechanism for
forcing the pointer to be released ( ie. SetReferenceCountToZero() )
would break my wrapping... :(

Dan


More information about the Insight-developers mailing list