Fix T96931: Crash on load with library overrides + multiple cloth cache slots.

Not really clear why that would only show with multiple caches... But
point cache system is beyond brittle anyway.

This fix solves the issue at two different levels:
* General safety check in `rna_Cache_info_length` that we do get a valid
  `pid`.
* Forbid usage of this `PointCache.info` RNA property in any
  diffing/LibOverride processing (since it's by definition runtime, volatile
  data).
This commit is contained in:
Bastien Montagne 2022-04-01 11:05:30 +02:00
parent 9a67f9173b
commit d34c4089f1
Notes: blender-bot 2023-05-31 04:43:10 +02:00
Referenced by issue #96931, Regression: Crash on load with library overrides + multiple cloth cache slots
1 changed files with 2 additions and 1 deletions

View File

@ -407,7 +407,7 @@ int rna_Cache_info_length(PointerRNA *ptr)
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
if (cache->flag & PTCACHE_FLAG_INFO_DIRTY) {
if (pid.cache != NULL && pid.cache->flag & PTCACHE_FLAG_INFO_DIRTY) {
BKE_ptcache_update_info(&pid);
}
@ -1016,6 +1016,7 @@ static void rna_def_pointcache_common(StructRNA *srna)
prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "info");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
/* Note that we do not actually need a getter here, `rna_Cache_info_length` will update the info
* string just as well. */
RNA_def_property_string_funcs(prop, NULL, "rna_Cache_info_length", NULL);