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:
authorJeroen Bakker <jeroen@blender.org>2020-09-16 12:53:55 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-16 12:55:48 +0300
commitd376aea61840587eddcf75386b804673e5593d60 (patch)
treebeb11a291d2bd49ee343ab663e8ee8a1eec75659 /source/blender
parentc5c22d1ce1ce874625ccdae51430b8fd9a18b24b (diff)
Fix: Showing Meta Data Crash
When Showing Meta data for an image where the buffer does not exist (missing file) it crashed. This patch removes the check on the image and only checks the availability of the buffer.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_image/space_image.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 5660320ae8a..1d23a409748 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -673,19 +673,17 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
/* Draw Meta data of the image isn't added to the DrawManager as it is
* used in other areas as well. */
if (sima->flag & SI_DRAW_METADATA) {
- Image *ima = ED_space_image(sima);
- if (ima != NULL) {
+ void *lock;
+ /* `ED_space_image_get_zoom` temporarily locks the image, so this needs to be done before
+ * the image is locked when calling `ED_space_image_acquire_buffer`. */
+ float zoomx, zoomy;
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
+ ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
+ if (ibuf) {
int x, y;
rctf frame;
- float zoomx, zoomy;
- void *lock;
-
- ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
- ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
-
BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
-
ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx, zoomy);
ED_space_image_release_buffer(sima, ibuf, lock);
}