Potential fix for T81963: Random crashes in liboverride code.

From the backtrace it looks like in some cases file save (which triggers
a general override updates) is done before other code has a chance to
re-generate pose data, leading to rna accessing freed memory.

I was never able to reproduce that here, so this is a tentative fix in
master, if it proves to be working for the studio it will be
cherry-picked into 2.91 release branch later.
This commit is contained in:
Bastien Montagne 2020-10-22 15:20:04 +02:00
parent 992a88b38b
commit f73dad211b
Notes: blender-bot 2023-02-14 06:23:08 +01:00
Referenced by issue #81963, Random rare crashes in override code - reported by studio
1 changed files with 9 additions and 0 deletions

View File

@ -1422,6 +1422,15 @@ void BKE_lib_override_library_main_operations_create(Main *bmain, const bool for
FOREACH_MAIN_ID_BEGIN (bmain, id) {
if (ID_IS_OVERRIDE_LIBRARY_REAL(id) &&
(force_auto || (id->tag & LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH))) {
/* Usual issue with pose, it's quiet rare but sometimes they may not be up to date when this
* function is called. */
if (GS(id->name) == ID_OB) {
Object *ob = (Object *)id;
if (ob->type == OB_ARMATURE) {
BLI_assert(ob->data != NULL);
BKE_pose_ensure(bmain, ob, ob->data, true);
}
}
/* Only check overrides if we do have the real reference data available, and not some empty
* 'placeholder' for missing data (broken links). */
if ((id->override_library->reference->tag & LIB_TAG_MISSING) == 0) {