[PyQt] Conversion to wrong SubClass
Matthias Kuhn
matthias at opengis.ch
Mon Jan 21 23:13:32 GMT 2019
Hi Phil
On 1/18/19 2:13 PM, Phil Thompson wrote:
> On 18 Jan 2019, at 12:48 pm, Matthias Kuhn <matthias at opengis.ch> wrote:
>> Or does this mean that if the refcount for this Python object dropped to
>> 0 the cache will be invalidated anyway (and the real issue here is, that
>> the python object is still alive somewhere)?
> It should be invalidated when the ref count reaches 0.
It seems to be doing that. But when an additional /Transfer/ annotation
comes into play things start to go worse.
The following code snippet reproduces the issue:
https://issues.qgis.org/issues/20661#note-2
The interesting bits are the (almost) last two lines of the loop
* pt_g.clone() is a /Factory/ method
* The QgsGeometry constructor has a /Transfer/ annotation on the
parameter, if this one is not called, everything goes well.
Here are the first couple of lines of the output:
------------------------------------------
new pt 0x5d98240
new pt 0x5f257c0
new pt 0x4283da0
new pt 0x5d98240
WHAT??????!!!!! 0x5f257c0
new pt 0x629fa60
new pt 0x5d3c470
WHAT??????!!!!! 0x5d98240
new pt 0x2e2ac90
new pt 0x4283da0
new pt 0x5dcef50
new pt 0x5f770d0
new pt 0x629fa60
WHAT??????!!!!! 0x5d98240
------------------------------------------
Any idea what the additional Transfer of the object triggers?
Best regards
Matthias
More information about the PyQt
mailing list