mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0031546: Application Framework - Memory leak (100 bytes) on Load / Close OCAF document
Class Standard_BaseDriver is inherited from Standard_Transient, its descendants are updated accordingly. Handle is used to manipulate objects of this class and its descendants (instead of references or raw pointers) to ensure automatic destruction. Added test bugs caf bug31546 Related: - Standard_OVERRIDE is added in declarations of virtual methods in descendants of Storage_BaseDriver - Methods operator << and operator >> are removed in descendants of Storage_BaseDriver (they repeat the same methods inherited from the base class) - Typedef PCDM_BaseDriverPointer is marked as deprecated - Unused class DDI_Ostream is removed - Private field Standard_Transient::count is renamed to myRefCount_ to avoid compiler warnings if the same name is used within the scope of a descendant class - Output of meaningful error messages is restored in DRAW commands fsdread and fsdwrite
This commit is contained in:
@@ -75,11 +75,11 @@ Standard_Transient* Standard_Transient::This() const
|
||||
// Increment reference counter
|
||||
void Standard_Transient::IncrementRefCounter() const
|
||||
{
|
||||
Standard_Atomic_Increment (&count);
|
||||
Standard_Atomic_Increment (&myRefCount_);
|
||||
}
|
||||
|
||||
// Decrement reference counter
|
||||
Standard_Integer Standard_Transient::DecrementRefCounter() const
|
||||
{
|
||||
return Standard_Atomic_Decrement (&count);
|
||||
return Standard_Atomic_Decrement(&myRefCount_);
|
||||
}
|
||||
|
@@ -37,10 +37,10 @@ public:
|
||||
public:
|
||||
|
||||
//! Empty constructor
|
||||
Standard_Transient() : count(0) {}
|
||||
Standard_Transient() : myRefCount_(0) {}
|
||||
|
||||
//! Copy constructor -- does nothing
|
||||
Standard_Transient (const Standard_Transient&) : count(0) {}
|
||||
Standard_Transient (const Standard_Transient&) : myRefCount_(0) {}
|
||||
|
||||
//! Assignment operator, needed to avoid copying reference counter
|
||||
Standard_Transient& operator= (const Standard_Transient&) { return *this; }
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
//!@name Reference counting, for use by handle<>
|
||||
|
||||
//! Get the reference counter of this object
|
||||
Standard_Integer GetRefCount() const { return count; }
|
||||
Standard_Integer GetRefCount() const { return myRefCount_; }
|
||||
|
||||
//! Increments the reference counter of this object
|
||||
Standard_EXPORT void IncrementRefCounter() const;
|
||||
@@ -101,8 +101,10 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
//! Reference counter
|
||||
mutable volatile Standard_Integer count;
|
||||
//! Reference counter.
|
||||
//! Note use of underscore, aimed to reduce probability
|
||||
//! of conflict with names of members of derived classes.
|
||||
mutable volatile Standard_Integer myRefCount_;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user