kkaempf / swig-issues

Issues from SWIG (testing)
0 stars 0 forks source link

Python gets deleted object when storing it passed from c++ #71

Open SwigAtSF opened 11 years ago

SwigAtSF commented 11 years ago

I'm not sure if it is a bug, but it's confusing anyway. The problem appears when I create object in C++ and pass it into python callback. Python code creates reference to it and when callback is finished, py reference points to deleted object. Is it possible someway to track if there are any links from python after calling callback and replace wrapped pointer to c++ object w/ pointer to copy of it, so python will not deal w/ dead object? May be user should be just warned in such case? is there some more beautiful solution? Please advise.

SwigAtSF commented 11 years ago

test case