[PyKDE] Re: clone member function deleting object
Paul F. Kunz
Paul_Kunz at slac.stanford.edu
Tue Mar 15 20:39:15 GMT 2005
Using sip.transfer(), as Phil suggested, keeps the destructor of my
object created by clone() from being destroyed. However, my object
is still not useable as it can't find the Python implemented methods
when it is called from C++ after return of clone.
Poking around, I found that sipFunctionBase::sipPySelf data member
has gotten reset to zero. Using SIP trace and adding some printing
in the generated sipFunctionBase.cpp file by hand, the trace back
FunctionBase * sipFunctionBase::clone() const (this=0x083c9d90)
sipPySelf = 0x419c623c
init_FunctionBase sipSelf = 0x419c629c
sipFunctionBase::sipFunctionBase(const FunctionBase&) (this=0x08406528)
sipPySelf = 0
sipCpp = 0x8406528
dealloc_FunctionBase sipSelf = 0x419c629c
const std::vector<double>& sipFunctionBase::getParameters() (this=0x08406528)
sipPySelf = 0
- sipFunctionBase::clone() finds the Python member function and calls
it. Looks ok
- The sipFunctionBase copy constructor gets called followed by Python
__init__ method. Looks ok
- on return, dealloc_FunctionBase is called with argument of the newly
created instance. It appears that sipPySelf is then set to zero!
- The very first call to a member function shows indeed that the member
sipPySelf is a null pointer.
Any ideas, suggestions?
More information about the PyQt