diff options
author | Bastien Montagne <bastien@blender.org> | 2020-11-02 13:56:34 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-11-02 13:58:01 +0300 |
commit | dca65390f056051ae02efe6a2b7ec82a8c26d2ac (patch) | |
tree | 6d4df26cc6e3e6981de9c30a49eb4a52697aa750 /source/blender | |
parent | 2b98a9269b46fe909f07125930651a6a8b58e8da (diff) |
Another attempt at fixing T81963: Random rare crashes in override code.
Adding another pass of ensuring valid up-to-date pose data in RNA
function itself...
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access_compare_override.c | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 57dc83f1db7..aa5e28b35bf 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -1359,7 +1359,7 @@ bool BKE_lib_override_library_operations_create(Main *bmain, ID *local) } if (GS(local->name) == ID_OB) { - /* Our beloved pose's bone cross-data pointers.. Usually, depsgraph evaluation would + /* Our beloved pose's bone cross-data pointers. Usually, depsgraph evaluation would * ensure this is valid, but in some situations (like hidden collections etc.) this won't * be the case, so we need to take care of this ourselves. */ Object *ob_local = (Object *)local; diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index 562738efdaa..d367bc663f1 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -26,6 +26,7 @@ #include "DNA_constraint_types.h" #include "DNA_key_types.h" #include "DNA_modifier_types.h" +#include "DNA_object_types.h" #include "BLI_listbase.h" #include "BLI_string.h" @@ -37,6 +38,7 @@ # include "PIL_time_utildefines.h" #endif +#include "BKE_armature.h" #include "BKE_idprop.h" #include "BKE_lib_override.h" #include "BKE_main.h" @@ -593,6 +595,27 @@ bool RNA_struct_override_matches(Main *bmain, } #endif + if (ptr_local->owner_id == ptr_local->data && GS(ptr_local->owner_id->name) == ID_OB) { + /* Our beloved pose's bone cross-data pointers. Usually, depsgraph evaluation would + * ensure this is valid, but in some situations (like hidden collections etc.) this won't + * be the case, so we need to take care of this ourselves. + * + * Note: Typically callers of this function (from BKE_lib_override area) will already have + * ensured this. However, studio is still reporting sporadic, unreproducible crashes due to + * invalid pose data, so think there are still some cases where some armatures are somehow + * missing updates (possibly due to dependencies?). Since calling this function on same ID + * several time is almost free, and safe even in a threaded context as long as it has been done + * at least once first outside of threaded processing, we do it another time here. */ + Object *ob_local = (Object *)ptr_local->owner_id; + if (ob_local->type == OB_ARMATURE) { + Object *ob_reference = (Object *)ptr_local->owner_id->override_library->reference; + BLI_assert(ob_local->data != NULL); + BLI_assert(ob_reference->data != NULL); + BKE_pose_ensure(bmain, ob_local, ob_local->data, true); + BKE_pose_ensure(bmain, ob_reference, ob_reference->data, true); + } + } + iterprop = RNA_struct_iterator_property(ptr_local->type); for (RNA_property_collection_begin(ptr_local, iterprop, &iter); iter.valid; |