Luabind, do not collect my garbages please?

neosettlers <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <000301c99621$69c27a90$3d476fb0$@ca>
Hi everyone, 

 

I m binding C++ classes and functions with Luabind in my C++ app.

 

My promblem is that when lua_close() is called, it try to delete pointers
wich are already being handle via a C++ memory manager. In short, I have no
need for Lua to collect my garbages from a C++ class being created in Lua.

 

Here is a simplify version of my work:

 

.cpp

 

            module(in_lua)

            [

                  /// Base class for all classes.

                  class_<Object, boost::shared_ptr<Object>>("Object)

                  .def(constructor<>())

                  ,

                  class_<Actor, Object, boost::shared_ptr<Object>>("Actor)

                  .def(constructor<>())

                  .def("SetGeometry", &Actor::SetGeometry)

                  ,

                  class_<Cube, Object, boost::shared_ptr<Cube>>("Cube")

                  .def(constructor<Float, Float, Float>())

            ];

 

.lua

 

myGeo = Cube(1,1,1);

 

myActor = Actor();

myActor:SetGeometry(myGeo);

 

App onExit():

 

1 - delete all C++ objects.

3 - lua_close().

 

I m using the boost::shared_ptr because it does not call the C++ object
destructors when lua_close() is called. 

 

It all works fine, but my promblem occurs when myActor:SetGeometry(myGeo);
is present, lua_close() try to delete myGeo when it has already been
deleted. And BAM!

 

What am I missing? I ve been stalled on this for many hours. I m currently
trying to make sens of how the adopt method could help me with this... how
far am I?

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
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.