Fix T73110: UDIM Texture Paint Crash

This would happen if a tile is found on disk, painting would actually
request that tile (because corresponding uvs were in that range), but
that tile was not added in blenders list of tiles in that Image.

Need to also check tile in `image_quick_test` (regardless of iuser
having passed).

thx @lukasstockner97 for additional input!

Maniphest Tasks: T73110

Differential Revision: https://developer.blender.org/D6578
This commit is contained in:
Philipp Oeser 2020-01-14 11:23:12 +01:00
parent ddddb94517
commit aee2b754dc
Notes: blender-bot 2023-02-14 02:22:07 +01:00
Referenced by issue #73110, UDIM Texture Paint Crash
1 changed files with 9 additions and 4 deletions

View File

@ -3891,7 +3891,12 @@ static void image_initialize_after_load(Image *ima, ImageUser *iuser, ImBuf *UNU
BKE_image_tag_time(ima);
ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser);
tile->ok = IMA_OK_LOADED;
/* Images should never get loaded if the corresponding tile does not exist,
* but we should at least not crash if it happens due to a bug elsewhere. */
BLI_assert(tile != NULL);
if (tile != NULL) {
tile->ok = IMA_OK_LOADED;
}
}
static int imbuf_alpha_flags_for_image(Image *ima)
@ -4764,14 +4769,14 @@ BLI_INLINE bool image_quick_test(Image *ima, ImageUser *iuser)
return false;
}
ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser);
if (iuser) {
if (iuser->ok == 0) {
return false;
}
}
else if (tile == NULL) {
ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser);
if (tile == NULL) {
return false;
}
else if (tile->ok == 0) {