Memory: add OBJECT_GUARDED_SAFE_DELETE like MEM_SAFE_FREE

This commit is contained in:
Brecht Van Lommel 2020-01-23 17:35:16 +01:00
parent 1107af1abb
commit c76a8f65b7
1 changed files with 9 additions and 0 deletions

View File

@ -278,6 +278,15 @@ template<class T> inline void OBJECT_GUARDED_DESTRUCTOR(T *what)
} \
} \
(void)0
# define OBJECT_GUARDED_SAFE_DELETE(what, type) \
{ \
if (what) { \
OBJECT_GUARDED_DESTRUCTOR((type *)what); \
MEM_freeN(what); \
what = NULL; \
} \
} \
(void)0
#endif /* __cplusplus */
#endif /* __MEM_GUARDEDALLOC_H__ */