[PyKDE] Re: clone member function deleting object

Paul F. Kunz Paul_Kunz at slac.stanford.edu
Mon Mar 14 15:02:07 GMT 2005


>>>>> 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)
python.clone
sipFunctionBase::sipFunctionBase(const FunctionBase&) (this=0x0842b2d8)
python.copy
sipFunctionBase::~sipFunctionBase() (this=0x0842b2d8)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1075068096 (LWP 12449)]
0x41abf5d8 in FunctionProjector::initializeFunction (this=0x8403940, 
    projector=0xbfffe4f0)
    at ../../hippodraw/projectors/FunctionProjector.cxx:135
Current language:  auto; currently c++
(gdb) 

The Python code looks like ...

from sihippo import FunctionBase
class Linear ( FunctionBase ) :
    def __init__ ( self, other = None ) :
        if other :
            FunctionBase.__init__( self, other )
            print "python.copy"
            self.initialize ()
        else:
            FunctionBase.__init__( self )
            print "python.default"
            self.initialize ()

    def clone ( self ) :
        print "python.clone"
        return Linear ( self )
    

The segmenetation fault above occurs when I try to use the cloned
function from C++.  It appears that SIP is destroying the clone
function when returning from the clone member function implemented in
Python. 

   What might I try next?




More information about the PyQt mailing list