[Bf-blender-cvs] [aee2b754dc8] blender-v2.82-release: Fix T73110: UDIM Texture Paint Crash

Philipp Oeser noreply at git.blender.org
Mon Jan 20 21:26:44 CET 2020


Commit: aee2b754dc8f5c4ddaf840cd83f979dd22fe4dc3
Author: Philipp Oeser
Date:   Tue Jan 14 11:23:12 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rBaee2b754dc8f5c4ddaf840cd83f979dd22fe4dc3

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

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

M	source/blender/blenkernel/intern/image.c

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

diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index f748ad64bc4..fe1f9097562 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -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) {



More information about the Bf-blender-cvs mailing list