[PyQt] wrapped C/C++ object of type has been deleted - yet it hasn't!
Nyall Dawson
nyall.dawson at gmail.com
Fri Jul 14 02:54:00 BST 2017
Hi list,
I've recently encountered an odd issue which has me stumped. I have a
c++ method which returns a new object (QgsProcessingAlgorithm* -
(which is not a QObject)), and the method is marked with a /Factory/
annotation.
Usually this approach works fine. But in this case the returned object
behaves oddly, and frequently encounters the "wrapped C/C++ object of
type has been deleted" error. Yet - it hasn't been deleted. I can put
a breakpoint in the c++ destructor for the class and it's not being
triggered. It's just that somehow the python wrapper has been mislead
into thinking this has occurred.
I can scatter various checks using sip.isdeleted around the code and
it all looks ok at first. Right up until a few references to this
object have been made in various other python objects. And then
boom... I suddenly get the "wrapped object has been deleted" error
from one of these references (without the c++ destructor being called)
I'm at a loss how to debug this, or what could be happening here. Any
hints on what could be causing this? Any likely suspects?
Nyall
More information about the PyQt
mailing list