|
Boost Users : |
Subject: [Boost-users] [boost-users][python] Problem with lifetime of object?
From: Germán Diago (germandiago_at_[hidden])
Date: 2009-08-27 04:04:30
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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net