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)?
This commit is contained in:
parent
1bc8ddbc6c
commit
93633efe69
Notes:
blender-bot
2024-03-22 15:57:27 +01:00
Referenced by commit 5ae8b1da02
, Fix wrong memory handling in own rB93633efe69ca.
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue