Updates to various files, replacing delete calls with osgDelete so that

greater debugging info can be gleaned.
This commit is contained in:
Robert Osfield
2002-03-27 14:56:47 +00:00
parent 7927335edf
commit 77ae5ddcb6
9 changed files with 27 additions and 25 deletions

View File

@@ -11,7 +11,7 @@ class DisplaySettingsPtr
DisplaySettingsPtr() : _ptr(0L) {}
DisplaySettingsPtr(DisplaySettings* t): _ptr(t) {}
DisplaySettingsPtr(const DisplaySettingsPtr& rp):_ptr(rp._ptr) { }
~DisplaySettingsPtr() { if (_ptr) delete _ptr; _ptr=0L; }
~DisplaySettingsPtr() { if (_ptr) osgDelete _ptr; _ptr=0L; }
inline DisplaySettings* get() { return _ptr; }

View File

@@ -15,7 +15,7 @@ using namespace osg;
GeoSet::GeoSet()
{
// we will use the a default delete functor which
// we will use the a default osgDelete functor which
// assumes that users have allocated arrays with new only
// and that now sharing of attributes exists between GeoSet's.
_adf = osgNew AttributeDeleteFunctor;
@@ -144,19 +144,19 @@ GeoSet::GeoSet(const GeoSet& geoset,const CopyOp& copyop):
void GeoSet::AttributeDeleteFunctor::operator() (GeoSet* gset)
{
// note, delete checks for NULL so want delete NULL pointers.
delete [] gset->getPrimLengths();
delete [] gset->getCoords();
delete [] gset->getNormals();
delete [] gset->getColors();
delete [] gset->getTextureCoords();
// can't delete a void* right now... interleaved arrays needs to be reimplemented with a proper pointer..
// delete [] gset->getInterleavedArray();
// note, osgDelete checks for NULL so want osgDelete NULL pointers.
osgDelete [] gset->getPrimLengths();
osgDelete [] gset->getCoords();
osgDelete [] gset->getNormals();
osgDelete [] gset->getColors();
osgDelete [] gset->getTextureCoords();
// can't osgDelete a void* right now... interleaved arrays needs to be reimplemented with a proper pointer..
// osgDelete [] gset->getInterleavedArray();
// coord indicies may be shared so we have to go through the long winded
// step of creating unique pointer sets which we then delete. This
// ensures that arrays aren't delete twice. Robert.
// ensures that arrays aren't osgDelete twice. Robert.
std::set<osg::ushort*> ushortList;
std::set<osg::uint*> uintList;
@@ -170,14 +170,14 @@ void GeoSet::AttributeDeleteFunctor::operator() (GeoSet* gset)
sitr!=ushortList.end();
++sitr)
{
delete [] *sitr;
osgDelete [] *sitr;
}
for(std::set<osg::uint*>::iterator iitr=uintList.begin();
iitr!=uintList.end();
++iitr)
{
delete [] *iitr;
osgDelete [] *iitr;
}
}

View File

@@ -34,16 +34,16 @@ void FieldReaderIterator::_free()
// free all data
if (_previousField)
{
delete _previousField;
osgDelete _previousField;
}
if (_fieldQueue)
{
for(int i=0;i<_fieldQueueCapacity;++i)
{
if (_fieldQueue[i]) delete _fieldQueue[i];
if (_fieldQueue[i]) osgDelete _fieldQueue[i];
_fieldQueue[i] = NULL;
}
delete [] _fieldQueue;
osgDelete [] _fieldQueue;
}
_init();
@@ -258,7 +258,7 @@ FieldReaderIterator& FieldReaderIterator::operator += (int no)
{
_fieldQueue[_fieldQueueSize+i] = tmpFields[i];
}
delete [] tmpFields;
osgDelete [] tmpFields;
}
return *this;
}

View File

@@ -294,7 +294,7 @@ char *osgDB::findDSO( const char *name )
strcat(prependosgPlugins,name);
fileFound = findFileInPath( prependosgPlugins , path );
delete [] prependosgPlugins;
osgDelete [] prependosgPlugins;
return fileFound;
#else // defined macintosh

View File

@@ -25,7 +25,7 @@ class RegistryPtr
RegistryPtr() : _ptr(0L) {}
RegistryPtr(Registry* t): _ptr(t) {}
RegistryPtr(const RegistryPtr& rp):_ptr(rp._ptr) { }
~RegistryPtr() { if (_ptr) delete _ptr; _ptr=0L; }
~RegistryPtr() { if (_ptr) osgDelete _ptr; _ptr=0L; }
inline Registry* get() { return _ptr; }

View File

@@ -52,7 +52,7 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
FTBitmapGlyph::~FTBitmapGlyph()
{
delete[] data;
osgDelete [] data;
}

View File

@@ -64,7 +64,7 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph)
FTPixmapGlyph::~FTPixmapGlyph()
{
delete[] data;
osgDelete [] data;
}

View File

@@ -30,7 +30,7 @@ VertexCache::VertexCache(int size)
VertexCache::~VertexCache()
{
delete[] entries;
osgDelete [] entries;
}
@@ -832,7 +832,7 @@ void NvStripifier::RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec&
}
osgDelete vcache;
delete[] bVisitedList;
osgDelete [] bVisitedList;
}
@@ -1634,7 +1634,7 @@ MyVertexVec& optimizedVerts)
}
}
delete[] indexCache;
osgDelete [] indexCache;
assert(optimizedVerts.size() == vertices.size());
}

View File

@@ -6,6 +6,8 @@
#include <vector>
#include <list>
#include <osg/MemoryManager>
/////////////////////////////////////////////////////////////////////////////////
//
// Types defined for stripification
@@ -133,7 +135,7 @@ class NvEdgeInfo
}
// ref and unref
void Unref () { if (--m_refCount == 0) delete this; }
void Unref () { if (--m_refCount == 0) osgDelete this; }
// data members are left public
UINT m_refCount;