diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-15 08:14:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-15 08:14:53 +0400 |
commit | f46ca7836d10fa05d589faa346eac42358893f1e (patch) | |
tree | 9b7194d7f8bec4e8cf66b2e71390d91e6699fe07 | |
parent | c6b3e0f8e466cfe3c2e31173b4c7e4399d2dc23f (diff) |
add debug check for mempool double free (or misuse of BLI_MEMPOOL_ALLOW_ITER),
some reports in the tracker show errors on bmesh iteration which could be caused by this.
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index bf228f7456a..7670b057a7f 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -245,6 +245,10 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) BLI_freenode *newhead = addr; if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) { +#ifndef NDEBUG + /* this will detect double free's */ + BLI_assert(newhead->freeword != FREEWORD); +#endif newhead->freeword = FREEWORD; } |