[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Userdata finalization order
- From: Wesley Smith <wesley.hoke@...>
- Date: Tue, 19 Oct 2010 13:00:37 -0700
It's extremely hard to follow your weak table code, which is maybe why
you didn't post it before. I still don't wee where your weak table
is. There's no __mode field set in what you post, and I imagine from
this code that the rest of your code is pretty hairy. If you could
draw a diagram showing dependencies, it might help, but it's my
opinion that you really need to simplify this stuff.
I'm not sure why you have lines and transforms represented as objects
in the first place, but assuming that's a desirable feature, you are
going to either have to have a reference counting mechanism or a clear
line of ownership modeled in lua using the environment table of a
userdata. For this last case, you could have Plot act as a factory
for Lines and Transforms. Plot owns those objects. When they're
pushed in to Lua, their userdata is linked to the Plot environment
table, preventing them from being collected if no longer referenced in
a script. When Plot is collected the Line and Transform userdata do
not free the underlying C++ structures because it's Plot's job to do
that.
wes
- References:
- Userdata finalization order, Petri Häkkinen
- Re: Userdata finalization order, Wesley Smith
- Re: Userdata finalization order, Petri Häkkinen
- Re: Userdata finalization order, Francesco Abbate
- Re: Userdata finalization order, Javier Guerra Giraldez
- Re: Userdata finalization order, Francesco Abbate
- Re: Userdata finalization order, Roberto Ierusalimschy
- Re: Userdata finalization order, Francesco Abbate
- Re: Userdata finalization order, Javier Guerra Giraldez
- Re: Userdata finalization order, Francesco Abbate
- Re: Userdata finalization order, Wesley Smith
- Re: Userdata finalization order, Francesco Abbate
- Re: Userdata finalization order, Wesley Smith
- Re: Userdata finalization order, Francesco Abbate