Fix (unreported) crash in liboverride after yesterday's commit.

Own mistake in rBbfb760e16acb.
This commit is contained in:
Bastien Montagne 2022-01-06 09:57:19 +01:00
parent 6f389f1bb8
commit e766dc9189
Notes: blender-bot 2023-02-14 09:02:40 +01:00
Referenced by issue #94681, Crash on load a blend file when used Blender build from 06.01.2022
2 changed files with 14 additions and 9 deletions

View File

@ -739,7 +739,8 @@ static void lib_override_overrides_group_tag_recursive(LibOverrideGroupTagData *
BLI_assert(ID_IS_OVERRIDE_LIBRARY(id_owner));
BLI_assert(data->is_override);
if (id_owner->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY) {
if (ID_IS_OVERRIDE_LIBRARY_REAL(id_owner) &&
(id_owner->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY) != 0) {
return;
}

View File

@ -1088,17 +1088,19 @@ static void rna_porperty_override_collection_subitem_lookup(
static void rna_property_override_check_resync(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *ptr_item_dst,
PointerRNA *ptr_item_src)
{
ID *id_owner = rna_property_override_property_real_id_owner(bmain, ptr_dst, NULL, NULL);
ID *id_owner_src = rna_property_override_property_real_id_owner(bmain, ptr_src, NULL, NULL);
ID *id_owner_dst = rna_property_override_property_real_id_owner(bmain, ptr_dst, NULL, NULL);
ID *id_src = rna_property_override_property_real_id_owner(bmain, ptr_item_src, NULL, NULL);
ID *id_dst = rna_property_override_property_real_id_owner(bmain, ptr_item_dst, NULL, NULL);
BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_owner));
BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_owner_src));
/* If the owner ID is not part of an override hierarchy, there is no possible resync. */
if (id_owner->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY) {
if (id_owner_src->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY) {
return;
}
@ -1123,9 +1125,9 @@ static void rna_property_override_check_resync(Main *bmain,
* NOTE: Here we are testing if `id_owner` is referencing itself, in that case the new
* override copy generated by `BKE_lib_override_library_update` will already have its
* self-references updated to itself, instead of still pointing to its linked source. */
(id_dst->lib == id_src->lib && id_dst != id_owner))) {
id_owner->tag |= LIB_TAG_LIB_OVERRIDE_NEED_RESYNC;
CLOG_INFO(&LOG, 3, "Local override %s detected as needing resync", id_owner->name);
(id_dst->lib == id_src->lib && id_dst != id_owner_dst))) {
id_owner_dst->tag |= LIB_TAG_LIB_OVERRIDE_NEED_RESYNC;
CLOG_INFO(&LOG, 3, "Local override %s detected as needing resync", id_owner_dst->name);
}
}
@ -1242,7 +1244,8 @@ void RNA_struct_override_apply(Main *bmain,
PointerRNA prop_ptr_src = RNA_property_pointer_get(&data_src, prop_src);
PointerRNA prop_ptr_dst = RNA_property_pointer_get(&data_dst, prop_dst);
rna_property_override_check_resync(bmain, ptr_dst, &prop_ptr_dst, &prop_ptr_src);
rna_property_override_check_resync(
bmain, ptr_dst, ptr_src, &prop_ptr_dst, &prop_ptr_src);
}
else if (op->rna_prop_type == PROP_COLLECTION) {
if (RNA_struct_is_ID(RNA_property_pointer_type(&data_src, prop_src))) {
@ -1273,7 +1276,8 @@ void RNA_struct_override_apply(Main *bmain,
op,
opop);
rna_property_override_check_resync(bmain, ptr_dst, ptr_item_dst, ptr_item_src);
rna_property_override_check_resync(
bmain, ptr_dst, ptr_src, ptr_item_dst, ptr_item_src);
}
}
}