diff options
author | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-23 19:07:07 +0000 |
---|---|---|
committer | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-23 19:07:07 +0000 |
commit | f5bf205c0a0633f8b0d2e7ba525fc7343b4f5b28 (patch) | |
tree | b5b93b082ed03364c191a72677b90166e4de4fae /ace/Caching_Strategies_T.cpp | |
parent | d8b409c94c6f308c988b58e9f8f4fd23814f2d76 (diff) | |
download | ATCD-f5bf205c0a0633f8b0d2e7ba525fc7343b4f5b28.tar.gz |
Verifies teh destructor and made poiinters to 0 on deletion
Diffstat (limited to 'ace/Caching_Strategies_T.cpp')
-rw-r--r-- | ace/Caching_Strategies_T.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/ace/Caching_Strategies_T.cpp b/ace/Caching_Strategies_T.cpp index 72d5e1ab953..99884316c9b 100644 --- a/ace/Caching_Strategies_T.cpp +++ b/ace/Caching_Strategies_T.cpp @@ -43,9 +43,13 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI { if (this->delete_cleanup_strategy_ == 1) delete this->cleanup_strategy_; + this->delete_cleanup_strategy_ = 0; + this->cleanup_strategy_ = 0; if (this->delete_caching_strategy_utility_ == 1) delete this->caching_strategy_utility_; + this->delete_caching_strategy_utility_ = 0; + this->caching_strategy_utility_ = 0; } template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int @@ -57,24 +61,27 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI // Initialise the cleanup strategy. // First we decide whether we need to clean up. - if (this->cleanup_strategy_ != 0 && + if (this->cleanup_strategy_ != 0 && this->delete_cleanup_strategy_ == 1 && cleanup_s != 0) { delete this->cleanup_strategy_; this->cleanup_strategy_ = 0; - this->delete_cleanup_strategy_ = delete_cleanup_strategy; + this->delete_cleanup_strategy_ = 0; } - + if (cleanup_s != 0) - this->cleanup_strategy_ = cleanup_s; + { + this->cleanup_strategy_ = cleanup_s; + this->delete_cleanup_strategy_ = delete_cleanup_strategy; + } else if (this->cleanup_strategy_ == 0) { ACE_NEW_RETURN (this->cleanup_strategy_, CLEANUP_STRATEGY, -1); - this->delete_cleanup_strategy_ = delete_cleanup_strategy; + this->delete_cleanup_strategy_ = 1; } // Initialise the caching strategy utility. @@ -86,18 +93,21 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI { delete this->caching_strategy_utility_; this->caching_strategy_utility_ = 0; - this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; + this->delete_caching_strategy_utility_ = 0; } - + if (utility_s != 0) - this->caching_strategy_utility_ = utility_s; + { + this->caching_strategy_utility_ = utility_s; + this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; + } else if (this->caching_strategy_utility_ == 0) { ACE_NEW_RETURN (this->caching_strategy_utility_, CACHING_STRATEGY_UTILITY, -1); - this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; + this->delete_caching_strategy_utility_ = 1; } return 0; |