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.
This commit is contained in:
parent
c5c22d1ce1
commit
d376aea618
Notes:
blender-bot
2023-05-31 04:43:10 +02:00
Referenced by issue #80885, Unpaired ED_image_undo_push_begin(..)
|
@ -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(®ion->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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue