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
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-01-23 19:35:16 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-01-27 14:22:01 +0300
commitc76a8f65b7e5f65b8c10b2d3b574c90ebc3d01c0 (patch)
tree8594ee28a6ee242488ee22955ddc0ebd8612f44f /intern
parent1107af1abb0d4bf271e995a18f5d4bd790d51d02 (diff)
Memory: add OBJECT_GUARDED_SAFE_DELETE like MEM_SAFE_FREE
Diffstat (limited to 'intern')
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 958e5ae86cd..2a4ae5355a0 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -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__ */