[Bf-blender-cvs] [93633efe69c] master: Fix (unreported) broken ID previews reading.

Bastien Montagne noreply at git.blender.org
Mon Mar 11 17:08:51 CET 2019


Commit: 93633efe69ca4e610304b34268e523f54f9d7d57
Author: Bastien Montagne
Date:   Mon Mar 11 17:05:03 2019 +0100
Branches: master
https://developer.blender.org/rB93633efe69ca4e610304b34268e523f54f9d7d57

Fix (unreported) broken ID previews reading.

Recent changes to blendfile reading adding deferred reading of actual
data broke it, we cannot use the nifty `bhead + 1` to access data
anymore, since there is no guaranty that that block hass been fully
read.

Note that there is still one case in `read_file_thumbnail()`, however
loading of blendfile preview itself seems to be working fine... Maybe
@campbellbarton can double check that point (or knows of hands whether
it is OK there)?

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

M	source/blender/blenloader/intern/readblenentry.c

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

diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 7fcacd8f30e..f59ed7eef48 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -204,7 +204,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 							size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(uint);
 							new_prv->rect[0] = MEM_callocN(len, __func__);
 							bhead = blo_bhead_next(fd, bhead);
-							rect = (uint *)(bhead + 1);
+							rect = BLO_library_read_struct(fd, bhead, "PreviewImage Icon Rect");
 							BLI_assert(len == bhead->len);
 							memcpy(new_prv->rect[0], rect, len);
 						}
@@ -221,7 +221,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 							size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(uint);
 							new_prv->rect[1] = MEM_callocN(len, __func__);
 							bhead = blo_bhead_next(fd, bhead);
-							rect = (uint *)(bhead + 1);
+							rect = BLO_library_read_struct(fd, bhead, "PreviewImage Image Rect");
 							BLI_assert(len == bhead->len);
 							memcpy(new_prv->rect[1], rect, len);
 						}



More information about the Bf-blender-cvs mailing list