From c69ca429c8d85bf9ef657619dd51d3a5f575548f Mon Sep 17 00:00:00 2001 From: Dongryeol Lee Date: Sun, 17 Oct 2010 19:07:31 +0000 Subject: [PATCH] Another fix. Now ready to get back to distributed table. --- .../thesis_research/core/table/dense_point.h | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/fastlib/trunk/contrib/dongryel/thesis_research/core/table/dense_point.h b/fastlib/trunk/contrib/dongryel/thesis_research/core/table/dense_point.h index 9d58fac5f1..a8632530d2 100644 --- a/fastlib/trunk/contrib/dongryel/thesis_research/core/table/dense_point.h +++ b/fastlib/trunk/contrib/dongryel/thesis_research/core/table/dense_point.h @@ -73,6 +73,18 @@ class DensePoint: public DenseConstPoint { bool is_alias_; + private: + void DestructPtr_() { + if(DenseConstPoint::ptr_ != NULL && is_alias_ == false) { + if(global_m_file_) { + global_m_file_->Deallocate(ptr_); + } + else { + delete[] DenseConstPoint::ptr_; + } + } + } + public: template @@ -112,14 +124,7 @@ class DensePoint: public DenseConstPoint { } virtual ~DensePoint() { - if(DenseConstPoint::ptr_ != NULL && is_alias_ == false) { - if(global_m_file_) { - global_m_file_->Deallocate(ptr_); - } - else { - delete[] DenseConstPoint::ptr_; - } - } + DestructPtr_(); Reset(); } @@ -149,9 +154,7 @@ class DensePoint: public DenseConstPoint { } void Copy(const DenseConstPoint &point_in) { - if(ptr_ && is_alias_ == false) { - delete ptr_; - } + DestructPtr_(); DenseConstPoint::ptr_ = (global_m_file_) ? (double *) global_m_file_->Allocate(