Fix rare crashes when reading files with multi-levels of libraries. #114784

Merged
Bastien Montagne merged 1 commits from mont29/blender:tmp-fix-readfile-crash into main 2023-11-13 15:02:11 +01:00

1 Commits

Author SHA1 Message Date
Bastien Montagne 1caa176f32 Fix rare crashes when reading files with multi-levels of libraries.
buildbot/vexp-code-patch-coordinator Build done. Details
Some left-over code from old refactoring/improvements of old addresses
remapping in library reading code was causing some wrong remapping
between different IDs.

The code was actually not doing what its comment was describing, since
it would cause a random remapping to a different new address than the
expected one:

Initial state, before removed buggy line:
`old_addr_1 -> new_addr_1`
`old_addr_2 -> new_addr_2`

End state, if `old_addr_2` == `new_addr_1`:
`old_addr_1 -> new_addr_2`
`old_addr_2 -> new_addr_2`

From the description of the removed line, that behavior was actually
already covered by adding the remapping rule in the line above, since
adding a remapping overwrite an existing one if needed, so the line
above would do (in case a placeholder ID existed before the actual ID
got read):

Initial state, before adding new remapping rule:
`old_addr_1 -> new_addr_placeholder_1`

End state, after adding remapping to newly read ID:
`old_addr_1 -> new_addr_1`

NOTE: Noticed thanks to rare failures of the liboverride tests on
buildbots. The issue was less than 1%-reproducible with a debug build
and ASAN, but had about 2-4% repducibility with release builds.
2023-11-13 11:19:29 +01:00