diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-04-08 09:12:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-04-08 13:19:26 +0300 |
commit | 4d4368389945b2b78e5d4f89b544a837bc157930 (patch) | |
tree | 62a354efe20282438903df1deb0692ffb9d3e4b8 | |
parent | e92a7800b57620df0a5d7619aead572667f27994 (diff) |
PyAPI: ImBuf.copy now copies the underlying imbuf
Without this, copy wasn't useful.
-rw-r--r-- | source/blender/python/generic/imbuf_py_api.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c index f2974239b9b..2a71991f88c 100644 --- a/source/blender/python/generic/imbuf_py_api.c +++ b/source/blender/python/generic/imbuf_py_api.c @@ -173,7 +173,15 @@ PyDoc_STRVAR(py_imbuf_copy_doc, static PyObject *py_imbuf_copy(Py_ImBuf *self) { PY_IMBUF_CHECK_OBJ(self); - return Py_ImBuf_CreatePyObject(self->ibuf); + ImBuf *ibuf_copy = IMB_dupImBuf(self->ibuf); + + if (UNLIKELY(ibuf_copy == NULL)) { + PyErr_SetString(PyExc_MemoryError, + "ImBuf.copy(): " + "failed to allocate memory memory"); + return NULL; + } + return Py_ImBuf_CreatePyObject(ibuf_copy); } static PyObject *py_imbuf_deepcopy(Py_ImBuf *self, PyObject *args) |