From 39c50d8f31bf63b4ccf22eae2d33b69e4cc0dc05 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 9 Mar 2022 15:28:16 +0100 Subject: [PATCH] Outliner: Ensure compiler error when passing wrong tree-element to macro Passing a `TreeElement *` instead of its `TreeStoreElement *` to `TSELEM_OPEN()` would seem to work but cause a bug. Add a type check that will cause a compiler error if it fails. --- source/blender/editors/space_outliner/outliner_intern.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner_intern.hh b/source/blender/editors/space_outliner/outliner_intern.hh index b9ffea7c735..a9bdcc56787 100644 --- a/source/blender/editors/space_outliner/outliner_intern.hh +++ b/source/blender/editors/space_outliner/outliner_intern.hh @@ -219,8 +219,9 @@ typedef enum { /* is the current element open? if so we also show children */ #define TSELEM_OPEN(telm, sv) \ - (((telm)->flag & TSE_CLOSED) == 0 || \ - (SEARCHING_OUTLINER(sv) && ((telm)->flag & TSE_CHILDSEARCH))) + (CHECK_TYPE_INLINE(telm, TreeStoreElem *), \ + (((telm)->flag & TSE_CLOSED) == 0 || \ + (SEARCHING_OUTLINER(sv) && ((telm)->flag & TSE_CHILDSEARCH)))) /** * Container to avoid passing around these variables to many functions.