Fix logic for calling PyObject_GC_UnTrack

All tracked objects need a matching un-track,
also remove redundant Py_XDECREF call.
This commit is contained in:
2021-03-04 15:06:15 +11:00
parent 0d28e2a334
commit a40ccde405
3 changed files with 4 additions and 7 deletions

View File

@@ -279,8 +279,8 @@ static void pygpu_batch__tp_dealloc(BPyGPUBatch *self)
GPU_batch_discard(self->batch);
#ifdef USE_GPU_PY_REFERENCES
PyObject_GC_UnTrack(self);
if (self->references) {
PyObject_GC_UnTrack(self);
pygpu_batch__tp_clear(self);
Py_XDECREF(self->references);
}

View File

@@ -202,8 +202,7 @@ static void pygpu_buffer__tp_dealloc(BPyGPUBuffer *self)
{
if (self->parent) {
PyObject_GC_UnTrack(self);
pygpu_buffer__tp_clear(self);
Py_XDECREF(self->parent);
Py_CLEAR(self->parent);
}
else {
MEM_freeN(self->buf.as_void);