Re: [Plib-users] reference counting and simpleStates
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2000-09-07 04:02:29
|
"Gouthas, Themie" wrote:
>
> I noticed when attaching states to tri-strip leaf nodes, that even though
> simpleState derrives from ssgBase, the reference count is unchanged
> and when a scene tree is deleted, the attached ssGsimpleState remains
> allocated.
>
> Is this a deliberate design feture or a bug?
Coincidentally - I noticed this just last weekend, I briefly looked at
fixing it - and it's not entirely simple. I'm also a little concerned
that fixing it will actually break some programs - so we have to tread
carefully and work with our end-users.
The scenario that concerns me is the kind of thing that TuxKart does:
* Load a set of textures, etc and populate a default set of
ssgSimpleStates (whose refcounts will now be zero - right?).
* Load the first racetrack - tell the loader not to create
materials - but to refer them to the app. The ref count
of all those ssgSimpleStates will be incremented,
* At the end of the race, we delete the scene graph and
load the next racetrack. Unfortunately deleting the
scene graph would decrement the ssgSimpleState's ref
count to zero...which would make SSG delete them...(which
it doesn't do right now because of the SSG bug) so
when the next racetrack is loaded...KABLOOIE!!
So - we *do* need to fix this - but we need to check with
our application authors to ensure that they do an extra 'ref'
to ssgSimpleState's that they need to keep.
This could happen in more subtle ways in packages like FGFS
which pages the scenery from disk on-the-fly.
It's simple enough to fix in the application - but we DO
have to sync up with those guys.
You'll notice that some of the fixes are in the CVS version
right now - but commented out.
--
Steve Baker HomeEmail: <sjb...@ai...>
WorkEmail: <sj...@li...>
HomePage : http://web2.airmail.net/sjbaker1
Projects : http://plib.sourceforge.net
http://tuxaqfh.sourceforge.net
http://tuxkart.sourceforge.net
http://prettypoly.sourceforge.net
|