Correctly use SIP to transfer ownership of objects from Python to C++

This commit is contained in:
AnyOldName3
2019-06-01 00:59:39 +01:00
parent 0c11e75f0f
commit e280b07cb6
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -612,7 +612,7 @@ struct QClass_converters
{
// This would transfer responsibility for deconstructing the object to C++, but Boost assumes l-value converters (such as this) don't do that
// Instead, this should be called within the wrappers for functions which return deletable pointers.
//sipAPI()->api_transfer_to(objPtr, 0);
//sipAPI()->api_transfer_to(objPtr, Py_None);
if (PyObject_TypeCheck(objPtr, sipAPI()->api_simplewrapper_type)) {
sipSimpleWrapper *wrapper;
wrapper = reinterpret_cast<sipSimpleWrapper*>(objPtr);
@@ -695,7 +695,7 @@ struct QInterface_converters
// This would transfer responsibility for deconstructing the object to C++, but Boost assumes l-value converters (such as this) don't do that
// Instead, this should be called within the wrappers for functions which return deletable pointers.
//sipAPI()->api_transfer_to(objPtr, 0);
//sipAPI()->api_transfer_to(objPtr, Py_None);
sipSimpleWrapper *wrapper = reinterpret_cast<sipSimpleWrapper*>(objPtr);
return wrapper->data;