From 8185d07ace493a74fb1b99636f4bb80174b81418 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Wed, 13 Jan 2021 12:33:39 +0300 Subject: RNA: fix a crash when setting bare IDProperty pointers. The rna_idproperty_check call should be done before accessing the prop pointer so that it can detect IDProperty values and replace them with the actual PointerPropertyRNA object. Ref D10098 --- source/blender/makesrna/intern/rna_access.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 0479c5d1eed..70757573051 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -3678,8 +3678,10 @@ void RNA_property_pointer_set(PointerRNA *ptr, PointerRNA ptr_value, ReportList *reports) { - PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; + /* Detect IDProperty and retrieve the actual PropertyRNA pointer before cast. */ IDProperty *idprop = rna_idproperty_check(&prop, ptr); + + PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; BLI_assert(RNA_property_type(prop) == PROP_POINTER); /* Check types. */ -- cgit v1.2.3