Hi Enrico,

On Tue, 2005-02-15 at 06:31, Enrico Borrione wrote:
> Thanks Andreas,
> the addRefCP did the trick.
> Just to clarify a bit my mind: i added the whole bunch
> of ChunkMaterials and readied 'em for the use in
> the init of the application.I noticed also a
> subRefCP function, which is used, i assume, to
> tell opensg that some chunks are no longer on 
> any use in the application. Should i subRefCP 
> my materials before the end of the program?
> I wouldn't like to keep zombies in my memory.

you can avoid thesae kinds of problems by using RefPtr<>s to store
pointers to FieldContainers in your data structures.

I assume you have a set of MaterialPtr variables in your GUI containe
and you assign these to the objects you want to manipulate. If you use
RefPtr<MaterialPtr> instead it automatically calls addRefCP when you
assign it a new variable, and subRefCP when it's changed to another one
or when it's destroyed (which also takes care of zombies). You need to
#include <RefPtr.h>, but the usage should be the same.

> thanks and sorry for the lameness :)

Refcounting is something many people struggle with, no lameness
involved.

Hope it helps

        Dirk





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to