[PyKDE] Re: clone member function deleting object
Paul F. Kunz
Paul_Kunz at slac.stanford.edu
Mon Mar 14 15:46:13 GMT 2005
>>>>> On Mon, 14 Mar 2005 15:34:04 -0000 (GMT), "Phil Thompson" <phil at riverbankcomputing.co.uk> said:
>>>>>>> On Thu, 3 Mar 2005 09:17:07 -0000 (GMT), "Phil Thompson"
>>>>>>> <phil at riverbankcomputing.co.uk> said:
>> Enabling tracing with SIP, I get the following when I call the
>> clone() member function in C++...
>> FunctionBase * sipFunctionBase::clone() const (this=0x083b0878)
>> sipFunctionBase::sipFunctionBase(const FunctionBase&) (this=0x0842b2d8)
>> sipFunctionBase::~sipFunctionBase() (this=0x0842b2d8)
> This isn't very helpful unless it shows your Python debug print
> statements so that you can see the exact order that things are
The Python print statements are prefixed by `python.'
> Obviously it will do this if you aren't saving the result of the
> call to clone().
I'm trying to save the results to clone() in C++.
>> What might I try next?
> Additional debug statements to see exactly which Python statement
> the dtor is being called from.
As far as I can see, from the above...
- C++ calls virtual function clone() of the base class (FunctionBase)
- sipFunctionBase get called, it calls clone() of the Python function.
- clone of the Python function calls the "copy constructor".
- sipFunctionBase copy constructor gets called and it calls Python
function's __init__ with two arguments
- Python __init__ prints "python.copy".
- sipFunctionBase destructor gets called, destroying the newly
More information about the PyQt