[Bf-blender-cvs] [8185d07ace4] master: RNA: fix a crash when setting bare IDProperty pointers.

Alexander Gavrilov noreply at git.blender.org
Wed Jan 13 12:10:24 CET 2021


Commit: 8185d07ace493a74fb1b99636f4bb80174b81418
Author: Alexander Gavrilov
Date:   Wed Jan 13 12:33:39 2021 +0300
Branches: master
https://developer.blender.org/rB8185d07ace493a74fb1b99636f4bb80174b81418

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

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

M	source/blender/makesrna/intern/rna_access.c

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

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



More information about the Bf-blender-cvs mailing list