Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-03-04 15:46:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-03-04 15:48:45 +0300
commitf4463cd865a228088a7c303c74a5a53b061dc260 (patch)
treeaa927c0fbb672c73f491bcce08f4eaa687df0d27 /source/blender/makesrna/intern/rna_define.c
parentd83c0969f6ee6d193f384341cbbd0455ef46dabd (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/makesrna/intern/rna_define.c')
-rw-r--r--source/blender/makesrna/intern/rna_define.c10
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)