mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0025571: Avoid base Classes without virtual Destructors
Destructors of collection classes from NCollection and math_Function are made virtual to allow safe destruction by pointer to base class. Destructors of classes HatchGen_IntersectionPoint, IntCurveSurface_Intersection, Intf_Interference, IntRes2d_Intersection are made protected to avoid possibility of destructing by pointer to corresponding base class.
This commit is contained in:
@@ -119,6 +119,11 @@ public:
|
||||
const Handle(NCollection_BaseAllocator)& Allocator() const
|
||||
{ return myAllocator; }
|
||||
|
||||
// ******** Destructor
|
||||
// Purpose: defines virtual interface
|
||||
virtual ~NCollection_BaseList (void)
|
||||
{}
|
||||
|
||||
protected:
|
||||
// --------- PROTECTED METHODS ----------
|
||||
|
||||
|
@@ -166,6 +166,9 @@ public:
|
||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
virtual ~NCollection_BaseMap() {}
|
||||
|
||||
//! BeginResize
|
||||
Standard_EXPORT Standard_Boolean BeginResize
|
||||
(const Standard_Integer NbBuckets,
|
||||
|
@@ -115,6 +115,9 @@ public:
|
||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
virtual ~NCollection_BaseSequence() {}
|
||||
|
||||
Standard_EXPORT void ClearSeq (NCollection_DelSeqNode fDel);
|
||||
Standard_EXPORT void PAppend (NCollection_SeqNode *);
|
||||
Standard_EXPORT void PAppend (NCollection_BaseSequence& S);
|
||||
|
@@ -184,6 +184,9 @@ protected: //! @name protected methods
|
||||
myData = allocMemBlocks (myCapacity);
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
virtual ~NCollection_BaseVector() {}
|
||||
|
||||
//! @return pointer to memory where to put the new item
|
||||
Standard_EXPORT void* expandV (const Standard_Integer theIndex);
|
||||
|
||||
|
@@ -359,7 +359,7 @@ class NCollection_DataMap : public NCollection_BaseMap
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
~NCollection_DataMap (void)
|
||||
virtual ~NCollection_DataMap (void)
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
|
@@ -593,7 +593,7 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
~NCollection_IndexedDataMap (void)
|
||||
virtual ~NCollection_IndexedDataMap (void)
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
|
@@ -454,7 +454,7 @@ class NCollection_IndexedMap : public NCollection_BaseMap
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
~NCollection_IndexedMap (void)
|
||||
virtual ~NCollection_IndexedMap (void)
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
|
@@ -271,7 +271,7 @@ public:
|
||||
{ PReverse(); }
|
||||
|
||||
//! Destructor - clears the List
|
||||
~NCollection_List (void)
|
||||
virtual ~NCollection_List (void)
|
||||
{ Clear(); }
|
||||
|
||||
private:
|
||||
|
@@ -290,7 +290,7 @@ class NCollection_Map : public NCollection_BaseMap
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
~NCollection_Map (void)
|
||||
virtual ~NCollection_Map (void)
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
|
@@ -325,7 +325,7 @@ public:
|
||||
{ ChangeValue (theIndex) = theItem; }
|
||||
|
||||
// ******** Destructor - clears the Sequence
|
||||
~NCollection_Sequence (void)
|
||||
virtual ~NCollection_Sequence (void)
|
||||
{ Clear(); }
|
||||
|
||||
private:
|
||||
|
@@ -165,7 +165,7 @@ public: //! @name public methods
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
~NCollection_Vector()
|
||||
virtual ~NCollection_Vector()
|
||||
{
|
||||
for (Standard_Integer anItemIter = 0; anItemIter < myCapacity; ++anItemIter)
|
||||
{
|
||||
|
Reference in New Issue
Block a user