Transferring ownership of lists of pointers
Nyall Dawson
nyall.dawson at gmail.com
Mon Feb 27 02:36:50 GMT 2023
Hi list,
I've a question regarding the correct way to transfer ownership of a list
of objects. I've searched for examples in the PyQt sip files, and the best
I can find is from QWinJumpList which indicates that a simple /Transfer/
annotation should work for transferring all the list items:
QWinJumpListCategory *addCategory(const QString &title,
const QList<QWinJumpListItem *> items /Transfer/ =
QList<QWinJumpListItem *>());
(from qwinjumplist.sip)
However, in my tests, just adding /Transfer/ to a list argument doesn't
correctly transfer all the ownership of these objects and I get crashes as
soon as one of the python list members gets garbage collected.
Should this work? Or is there a better/safer/"canonical" way to transfer
lists of objects in sip?
Thanks in advance,
Nyall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20230227/a0c0a843/attachment.htm>
More information about the PyQt
mailing list