[boost-users][python] Problem with lifetime of object?

Hello. I would like to know what's wrong with this: Object * create() { return new Object(); } void addToScene(const std::string & name, Object * o) { //Store object in a std::multimap<std::string, Object *> } BOOST_PYTHON_MODULE(mod) { def("createObject", &create, return_value_policy<reference_existing_object>()); .... } I start my application, it works ok and it uses addToScene and create: Now I try to add a new object to my application from python:
obj = Object() addToScene("obj", obj)
Should the problem have anything to do with object lifetime? Or the segmentation fault is because of another issue? Thanks in advance.

On Thu, Aug 27, 2009 at 2:11 AM, Germán Diago<germandiago@gmail.com> wrote:
Sorry, there's an error in the python code, I meant:
obj = createObject() addToScene("obj", obj)
Thanks in advance.
I would guess another issue, from just a quick look the lifetime seems fine, but we need to see more of your code to make a better guess.
participants (2)
-
Germán Diago
-
OvermindDL1