pyqt  

[PyQt] SIP, object destruction, and sip.setdeleted

Kevin Watters
Tue, 29 Apr 2008 15:39:45 -0700

I've got a couple quick questions about SIP's handling of object destruction.

The docs for sip.setdeleted says

setdeleted(obj)
    This marks the C++ instance or C structure as having been destroyed or
returned to the heap so that future references to it raise an exception rather
than cause a program crash. Normally SIP handles such things automatically, but
there are circumstances where this isn't possible. obj is the Python object.

How does SIP handle this situation "automatically?" I don't see anything going
on in the release_XXX methods in my class wrappers, other than

    delete reinterpret_cast<XXX *>(ptr);

Also, some of my classes have a Destroy method whose implementation is to just
to call

delete this;

Without the SIP wrappers defining a virtual destructor of their own, is there
any way for SIP to recognize that it should mark any existing Python instances
as "deleted?"

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt