[Bf-blender-cvs] [dca65390f05] master: Another attempt at fixing T81963: Random rare crashes in override code.

Bastien Montagne noreply at git.blender.org
Mon Nov 2 11:58:15 CET 2020


Commit: dca65390f056051ae02efe6a2b7ec82a8c26d2ac
Author: Bastien Montagne
Date:   Mon Nov 2 11:56:34 2020 +0100
Branches: master
https://developer.blender.org/rBdca65390f056051ae02efe6a2b7ec82a8c26d2ac

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...

===================================================================

M	source/blender/blenkernel/intern/lib_override.c
M	source/blender/makesrna/intern/rna_access_compare_override.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list