Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2022-01-19 01:23:08 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-01-19 01:23:16 +0300
commit2e5aecf557fb6bc9fe9c652e692905feb1bde484 (patch)
treef8a199462f2741915c4b6acc4231dd59d107a584
parent221ff895d962a305d37eafd72f236a84d2e979b8 (diff)
Fix T94202: GPUFrameBuffer: wrong refcount in the buffer passed for read_color and read_depth
The buffer passed as an argument to `GPUFrameBuffer.read_color` is used in the return of the function and therefore, if not used, its refcount is decremented. So be sure to increment the refcount of the already existing objects that will be used in the return of a function.
-rw-r--r--source/blender/python/gpu/gpu_py_framebuffer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/python/gpu/gpu_py_framebuffer.c b/source/blender/python/gpu/gpu_py_framebuffer.c
index a9347b71723..412fcac02ca 100644
--- a/source/blender/python/gpu/gpu_py_framebuffer.c
+++ b/source/blender/python/gpu/gpu_py_framebuffer.c
@@ -530,6 +530,7 @@ static PyObject *pygpu_framebuffer_read_color(BPyGPUFrameBuffer *self,
PyErr_SetString(PyExc_BufferError, "the buffer size is smaller than expected");
return NULL;
}
+ Py_INCREF(py_buffer);
}
else {
py_buffer = BPyGPU_Buffer_CreatePyObject(
@@ -590,6 +591,7 @@ static PyObject *pygpu_framebuffer_read_depth(BPyGPUFrameBuffer *self,
PyErr_SetString(PyExc_BufferError, "the buffer size is smaller than expected");
return NULL;
}
+ Py_INCREF(py_buffer);
}
else {
py_buffer = BPyGPU_Buffer_CreatePyObject(GPU_DATA_FLOAT, (Py_ssize_t[]){h, w}, 2, NULL);