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:
authorPhilipp Oeser <info@graphics-engineer.com>2021-11-26 10:33:45 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-11-26 13:46:26 +0300
commit236be8e9f1c92fe47fee9af72dad752f3a5452ee (patch)
tree5b6bf4cdfe97e90c8b3e40cee967d71728be9e87 /source/blender
parentdcc500e5a265093bc9ccb87a57f47ba3fd2de93f (diff)
Fix T93380: Texture paint clone tool crash without clone image
This was crashing using the clone tool without a clone image assigned. Caused by {rB9111ea78acf4}. Since above commit, `BKE_image_acquire_ibuf` was using `ima->runtime` without checking for NULL first. Since callers are not required to check for this, just return early here. note: there is still a memory leak using the clone tool without a clone image assigned (but this was also the case before said commit and needs to be investigated separately). Maniphest Tasks: T93380 Differential Revision: https://developer.blender.org/D13377
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/image.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 99700634288..22529467a14 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -5142,12 +5142,16 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
/* return image buffer for given image and user
*
* - will lock render result if image type is render result and lock is not NULL
- * - will return NULL if image type if render or composite result and lock is NULL
+ * - will return NULL if image is NULL or image type is render or composite result and lock is NULL
*
* references the result, BKE_image_release_ibuf should be used to de-reference
*/
ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
{
+ if (ima == NULL) {
+ return NULL;
+ }
+
ImBuf *ibuf;
BLI_mutex_lock(ima->runtime.cache_mutex);