ade83b21d1428a02f2a413dd82248057f7e808a1
The root of the issue was that while reading a new blendfile, the current `G_MAIN` is still the old one, not the one in which new data is being read. Since the remapping callback taking care of UI data during ID remapping is using `G_MAIN`, it is processing the wrong data, so when deleting the invalid shapekey (from `BLO_main_validate_shapekeys`), the UI data of the new bmain would not be properly remapped, causing invalid memory access later when recomputing user counts (calls to `BKE_main_id_refcount_recompute`). This is fixed by adding a new `BKE_id_delete_ex` function that takes extra remapping options parameter, and calling it from `BLO_main_validate_shapekeys` with extra option to enforce handling of UI data by remapping code. NOTE: At some point we have to check if that whole UI-callback thing is still needed, would be good to get rid of it and systematically process UI-related ID pointers like any others. Current situation is... fragile to say the least.
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
