diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp index 5569addbd7..a5375e13fc 100644 --- a/src/core/pool_func.hpp +++ b/src/core/pool_func.hpp @@ -196,6 +196,7 @@ DEFINE_POOL_METHOD(void)::FreeItem(size_t index) DEFINE_POOL_METHOD(void)::CleanPool() { this->cleaning = true; + Titem::PreCleanPool(); for (size_t i = 0; i < this->first_unused; i++) { delete this->Get(i); // 'delete NULL;' is very valid } diff --git a/src/core/pool_type.hpp b/src/core/pool_type.hpp index 4d20ed1abb..70f6480103 100644 --- a/src/core/pool_type.hpp +++ b/src/core/pool_type.hpp @@ -286,6 +286,13 @@ struct Pool : PoolBase { * @note it's called only when !CleaningPool() */ static inline void PostDestructor(size_t index) { } + + /** + * Dummy function called before a pool is about to be cleaned. + * If you want to use it, override it in PoolItem's subclass. + * @note it's called only when CleaningPool() + */ + static inline void PreCleanPool() { } }; private: