diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-03-04 15:46:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-03-04 15:48:45 +0300 |
commit | f4463cd865a228088a7c303c74a5a53b061dc260 (patch) | |
tree | aa927c0fbb672c73f491bcce08f4eaa687df0d27 /source/blender | |
parent | d83c0969f6ee6d193f384341cbbd0455ef46dabd (diff) |
RNA: ensure missing calls to RNA_enum_item_end crash in debug mode
Would have prevented T74227 from slipping through
since it didn't crash on some systems.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 56516c8af4d..aed2c94b493 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -4350,6 +4350,16 @@ void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropert (*items)[tot] = *item; *totitem = tot + 1; + + /* Ensure we get crashes on missing calls to 'RNA_enum_item_end', see T74227. */ +#ifdef DEBUG + static const EnumPropertyItem item_error = { + -1, POINTER_FROM_INT(-1), -1, POINTER_FROM_INT(-1), POINTER_FROM_INT(-1)}; + if (item != &item_error) { + RNA_enum_item_add(items, totitem, &item_error); + *totitem -= 1; + } +#endif } void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem) |