Fix T83055: setting rna pointer properties can create bogus custom properties

This was reported in the form of the eyedropper of the 'Parent' property
creating a custom property 'parent' if self was picked.

Problem arises when certain checks for setting rna pointer properties
failed (for example: the PROP_ID_SELF_CHECK check) and then a different
code path was entered (which was only meant for IDProperties).

Problem was introduced in rBa7b3047cefcb.

To solve, now first enter the branch for rna-based pointer properties,
then perform the sanity-checks (and if these fail: dont enter the other
unrelated codepath but instead do nothing)

Maniphest Tasks: T83055

Differential Revision: https://developer.blender.org/D9652
This commit is contained in:
Philipp Oeser 2020-11-26 16:21:55 +01:00
parent 4b248c1658
commit 841ae18605
Notes: blender-bot 2023-02-14 11:28:43 +01:00
Referenced by issue #83055, Eyedropper of the Parent property can create bogus self-reference
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 5 additions and 3 deletions

View File

@ -3723,9 +3723,11 @@ void RNA_property_pointer_set(PointerRNA *ptr,
}
}
/* RNA property. */
else if (pprop->set && !((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
!((prop->flag & PROP_ID_SELF_CHECK) && ptr->owner_id == ptr_value.owner_id)) {
pprop->set(ptr, ptr_value, reports);
else if (pprop->set) {
if (!((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
!((prop->flag & PROP_ID_SELF_CHECK) && ptr->owner_id == ptr_value.owner_id)) {
pprop->set(ptr, ptr_value, reports);
}
}
/* IDProperty desguised as RNA property (and not yet defined in ptr). */
else if (prop->flag & PROP_EDITABLE) {