super bad

Nigel Atkinson <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1258848652.1914.25.camel@octavo>
Hello list!

I had a bug in an app I'm writing, and while it was my goof i.e. you
shouldn't really rely on the order of objects being garbage collected, I
thought I'd share a debugging post mortem.  I'm using 0.9.0 but it may
apply to 0.8.1 and possibly 0.7 

So I found that last created instance of a Lua class that has a base
class, stayed around until lua_close, despite having any reference I
knew about set to nil.

In hind sight 'super' seems almost obvious.  Even though it is
deprecated, it's still there, to tell you its deprecated when you use
it. 

It took me awhile to narrow it down to this, as I had shared pointers in
the mix witch sent me barking up the wrong tree. ;-)

I just commented out the 'super' code in class_rep.cpp in the 

int luabind::detail::class_rep::constructor_dispatcher(lua_State* L)

function.  It's pretty obvious what to zap.  

Seeing as super is depreciated, this problem will go away eventually.  A
quick fix I guess would be to set 'super' to nil, after you have created
a class instance.

Hope this prevents or reduces some face-palms and keyboard thumping. :-)

Nigel Atkinson


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.