Hi Marcus,

On Sat, 2005-08-13 at 13:09 +0200, Marcus Lindblom wrote:
>
> Code like that will, in general, wreak havoc on any application, as 
> other RefPtrs will not be informed that their object has been destroyed, 
> so accesses via them will lead to undefined behaviour (most likely 
> crashes). This issue is fixable with either weak-pointers (such as those 
> used with boost::shared_ptr) or some other 
> is-(being)-destroyed-notification mechanism.

Yup.

> My 0.02 SEK on design of reference counting systems is that the 
> preffered way is to disallow users to change the ref-count explicitly 
> (i.e. encapsulate this in the well-behaved RefPtr-class, and similar 
> structures) but allow them to access this for reading (so that 
> deviations from expected ref-count can be checked, in case of unwanted 
> cycles and such). Manual ref-counting is, from my experience, quite 
> error-prone. However, I don't know if this is an option for the OpenSG 
> user base, as they might be doing a lot of explicit add/sub-refs.

I'm hoping to motivate people to move over to RefPtr for use in
applications and away from explicit add/subRefs. For backwards
compatibility they will stay around for a while, though.

So, everybody feel motivated to use RefPtrs to store data in your
apps! :)

> On a similar topic, is there some debug mechanism (existing or planned) 
> to report whether all OSG-objects have been freed upon applicaiton exit 
> (or before that)? Some ref-counted systems keep a global count over the 
> number of live ref-counted objects at any time, and this number can be 
> used to detect such errors. I kind of like being able to assert those 
> kind of things.

See Fredrik's mail.

        Dirk




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to