[Bf-blender-cvs] [d376aea6184] master: Fix: Showing Meta Data Crash

Jeroen Bakker noreply at git.blender.org
Wed Sep 16 11:55:53 CEST 2020


Commit: d376aea61840587eddcf75386b804673e5593d60
Author: Jeroen Bakker
Date:   Wed Sep 16 11:53:55 2020 +0200
Branches: master
https://developer.blender.org/rBd376aea61840587eddcf75386b804673e5593d60

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.

===================================================================

M	source/blender/editors/space_image/space_image.c

===================================================================

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);
       }



More information about the Bf-blender-cvs mailing list