Fix T89253: template_list allows arbitrary data changes

Blender forbids property changes in .draw() methods. But they weren't
caught after a call to .template_list() with a custom list type.

Support nested calls that disallow writes.
This commit is contained in:
Germano Cavalcante 2021-08-10 19:50:58 +10:00 committed by Campbell Barton
parent 182edd4c35
commit 895d3cd11e
Notes: blender-bot 2023-02-14 09:02:41 +01:00
Referenced by issue #89253, `.draw()` method allows arbitrary scene changes after calling `.template_list()` with custom list type.
1 changed files with 3 additions and 1 deletions

View File

@ -8681,6 +8681,8 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
}
#ifdef USE_PEDANTIC_WRITE
/* Handle nested draw calls, see: T89253. */
const bool rna_disallow_writes_prev = rna_disallow_writes;
rna_disallow_writes = is_readonly ? true : false;
#endif
/* *** Main Caller *** */
@ -8690,7 +8692,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
/* *** Done Calling *** */
#ifdef USE_PEDANTIC_WRITE
rna_disallow_writes = false;
rna_disallow_writes = rna_disallow_writes_prev;
#endif
RNA_parameter_list_end(&iter);