Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Andrew Bauer
VTK
Commits
7e4b0f09
Commit
7e4b0f09
authored
Jul 25, 1995
by
Will Schroeder
Browse files
ENH: Fixed delete stuff.
parent
d912a152
Changes
18
Hide whitespace changes
Inline
Side-by-side
src/Actor.cc
View file @
7e4b0f09
...
...
@@ -58,7 +58,7 @@ vtkActor::vtkActor()
vtkActor
::~
vtkActor
()
{
if
(
this
->
SelfCreatedProperty
&&
this
->
Property
!=
NULL
)
delete
this
->
Property
;
this
->
Property
->
Delete
()
;
}
// Description:
...
...
@@ -86,7 +86,7 @@ void vtkActor::SetProperty(vtkProperty *lut)
{
if
(
this
->
Property
!=
lut
)
{
if
(
this
->
SelfCreatedProperty
)
delete
this
->
Property
;
if
(
this
->
SelfCreatedProperty
)
this
->
Property
->
Delete
()
;
this
->
SelfCreatedProperty
=
0
;
this
->
Property
=
lut
;
this
->
Modified
();
...
...
src/AppendF.cc
View file @
7e4b0f09
...
...
@@ -163,9 +163,11 @@ void vtkAppendFilter::Execute()
this
->
InsertNextCell
(
ds
->
GetCellType
(
cellId
),
newPtIds
);
}
}
// Update ourselves
//
// Update ourselves and release memory
//
this
->
SetPoints
(
newPts
);
newPts
->
Delete
();
}
void
vtkAppendFilter
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
...
...
src/AppendP.cc
View file @
7e4b0f09
...
...
@@ -199,21 +199,22 @@ void vtkAppendPolyData::Execute()
}
}
//
// Update ourselves
// Update ourselves
and release memory
//
this
->
SetPoints
(
newPts
);
newPts
->
Delete
();
if
(
newVerts
->
GetNumberOfCells
()
>
0
)
this
->
SetVerts
(
newVerts
);
else
delete
newVerts
;
newVerts
->
Delete
()
;
if
(
newLines
->
GetNumberOfCells
()
>
0
)
this
->
SetLines
(
newLines
);
else
delete
newLines
;
newLines
->
Delete
()
;
if
(
newPolys
->
GetNumberOfCells
()
>
0
)
this
->
SetPolys
(
newPolys
);
else
delete
newPolys
;
newPolys
->
Delete
()
;
if
(
newStrips
->
GetNumberOfCells
()
>
0
)
this
->
SetStrips
(
newStrips
);
else
delete
newStrips
;
newStrips
->
Delete
()
;
this
->
Squeeze
();
}
...
...
src/Axes.cc
View file @
7e4b0f09
...
...
@@ -88,14 +88,20 @@ void vtkAxes::Execute()
newScalars
->
InsertNextScalar
(
0.5
);
newNormals
->
InsertNextNormal
(
n
);
newLines
->
InsertNextCell
(
2
,
ptIds
);
//
// Update self
// Update self
and release memory
//
this
->
SetPoints
(
newPts
);
newPts
->
Delete
();
this
->
PointData
.
SetScalars
(
newScalars
);
newScalars
->
Delete
();
this
->
PointData
.
SetNormals
(
newNormals
);
newNormals
->
Delete
();
this
->
SetLines
(
newLines
);
newLines
->
Delete
();
}
void
vtkAxes
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
...
...
src/BYURead.cc
View file @
7e4b0f09
...
...
@@ -153,7 +153,10 @@ void vtkBYUReader::ReadGeometryFile(FILE *geomFile, int &numPts)
<<
numPolys
<<
" polygons."
);
this
->
SetPoints
(
newPts
);
newPts
->
Delete
();
this
->
SetPolys
(
newPolys
);
newPolys
->
Delete
();
}
void
vtkBYUReader
::
ReadDisplacementFile
(
int
numPts
)
...
...
@@ -186,6 +189,7 @@ void vtkBYUReader::ReadDisplacementFile(int numPts)
vtkDebugMacro
(
<<
"Read "
<<
numPts
<<
" displacements"
);
this
->
PointData
.
SetVectors
(
newVectors
);
newVectors
->
Delete
();
}
void
vtkBYUReader
::
ReadScalarFile
(
int
numPts
)
...
...
@@ -218,6 +222,7 @@ void vtkBYUReader::ReadScalarFile(int numPts)
vtkDebugMacro
(
<<
"Read "
<<
numPts
<<
" scalars"
);
this
->
PointData
.
SetScalars
(
newScalars
);
newScalars
->
Delete
();
}
void
vtkBYUReader
::
ReadTextureFile
(
int
numPts
)
...
...
@@ -250,6 +255,7 @@ void vtkBYUReader::ReadTextureFile(int numPts)
vtkDebugMacro
(
<<
"Read "
<<
numPts
<<
" texture coordinates"
);
this
->
PointData
.
SetTCoords
(
newTCoords
);
newTCoords
->
Delete
();
}
void
vtkBYUReader
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
...
...
src/BoolSPts.cc
View file @
7e4b0f09
...
...
@@ -162,15 +162,14 @@ void vtkBooleanStructuredPoints::InitializeBoolean()
if
(
inScalars
!=
NULL
)
{
newScalars
=
inScalars
->
MakeObject
(
numPts
);
this
->
PointData
.
SetScalars
(
newScalars
);
newScalars
->
Delete
();
newScalars
=
inScalars
->
MakeObject
(
numPts
);
//copy
}
else
{
newScalars
=
new
vtkFloatScalars
(
numPts
);
this
->
PointData
.
SetScalars
(
newScalars
);
}
this
->
PointData
.
SetScalars
(
newScalars
);
newScalars
->
Delete
();
}
...
...
src/BoolText.cc
View file @
7e4b0f09
...
...
@@ -88,6 +88,7 @@ void vtkBooleanTexture::Execute()
// Update ourselves
//
this
->
PointData
.
SetScalars
(
newScalars
);
newScalars
->
Delete
();
}
void
vtkBooleanTexture
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
...
...
src/BrownPts.cc
View file @
7e4b0f09
...
...
@@ -74,6 +74,7 @@ void vtkBrownianPoints::Execute()
this
->
PointData
.
PassData
(
this
->
Input
->
GetPointData
());
this
->
GetPointData
()
->
SetVectors
(
newVectors
);
newVectors
->
Delete
();
}
void
vtkBrownianPoints
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
...
...
src/Camera.cc
View file @
7e4b0f09
...
...
@@ -66,7 +66,7 @@ vtkCamera::~vtkCamera()
{
if
(
this
->
Device
)
{
delete
this
->
Device
;
this
->
Device
->
Delete
()
;
}
}
...
...
src/Cell.cc
View file @
7e4b0f09
...
...
@@ -14,6 +14,15 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include
"Cell.hh"
// Description:
// Construct cell.
vtkCell
::
vtkCell
()
:
Points
(
MAX_CELL_SIZE
),
PointIds
(
MAX_CELL_SIZE
)
{
this
->
Points
.
ReferenceCountingOff
();
}
//
// Instantiate cell from outside
//
...
...
src/CleanP.cc
View file @
7e4b0f09
...
...
@@ -28,7 +28,7 @@ vtkCleanPolyData::vtkCleanPolyData()
vtkCleanPolyData
::~
vtkCleanPolyData
()
{
if
(
this
->
SelfCreatedLocator
&&
this
->
Locator
!=
NULL
)
delete
this
->
Locator
;
this
->
Locator
->
Delete
()
;
}
void
vtkCleanPolyData
::
Execute
()
...
...
@@ -73,7 +73,7 @@ void vtkCleanPolyData::Execute()
if
(
this
->
SelfCreatedLocator
)
// in case tolerance is changed
{
this
->
SelfCreatedLocator
=
0
;
delete
this
->
Locator
;
this
->
Locator
->
Delete
()
;
this
->
Locator
=
NULL
;
}
//
...
...
@@ -214,16 +214,32 @@ void vtkCleanPolyData::Execute()
newStrips
->
GetNumberOfCells
()
<<
" strips"
);
}
//
// Update ourselves
// Update ourselves
and release memory
//
delete
[]
Index
;
this
->
SetPoints
(
newPts
);
this
->
SetVerts
(
newVerts
);
this
->
SetLines
(
newLines
);
this
->
SetPolys
(
newPolys
);
this
->
SetStrips
(
newStrips
);
newPts
->
Delete
();
if
(
newVerts
)
{
this
->
SetVerts
(
newVerts
);
newVerts
->
Delete
();
}
if
(
newLines
)
{
this
->
SetLines
(
newLines
);
newLines
->
Delete
();
}
if
(
newPolys
)
{
this
->
SetPolys
(
newPolys
);
newPolys
->
Delete
();
}
if
(
newStrips
)
{
this
->
SetStrips
(
newStrips
);
newStrips
->
Delete
();
}
}
// Description:
...
...
@@ -233,7 +249,7 @@ void vtkCleanPolyData::SetLocator(vtkLocator *locator)
{
if
(
this
->
Locator
!=
locator
)
{
if
(
this
->
SelfCreatedLocator
)
delete
this
->
Locator
;
if
(
this
->
SelfCreatedLocator
)
this
->
Locator
->
Delete
()
;
this
->
SelfCreatedLocator
=
0
;
this
->
Locator
=
locator
;
this
->
Modified
();
...
...
@@ -242,7 +258,7 @@ void vtkCleanPolyData::SetLocator(vtkLocator *locator)
void
vtkCleanPolyData
::
CreateDefaultLocator
()
{
if
(
this
->
SelfCreatedLocator
)
delete
this
->
Locator
;
if
(
this
->
SelfCreatedLocator
)
this
->
Locator
->
Delete
()
;
if
(
this
->
Tolerance
<=
0.0
)
this
->
Locator
=
new
vtkMergePoints
;
...
...
src/ConeSrc.cc
View file @
7e4b0f09
...
...
@@ -136,15 +136,18 @@ void vtkConeSource::Execute()
// Update ourselves
//
this
->
SetPoints
(
newPoints
);
newPoints
->
Delete
();
if
(
newPolys
)
{
newPolys
->
Squeeze
();
// we may have estimated size; reclaim some space
this
->
SetPolys
(
newPolys
);
newPolys
->
Delete
();
}
else
{
this
->
SetLines
(
newLines
);
newLines
->
Delete
();
}
}
...
...
src/ConnectF.cc
View file @
7e4b0f09
...
...
@@ -144,7 +144,7 @@ void vtkConnectivityFilter::Execute()
vtkDebugMacro
(
<<
"Exceeded recursion depth "
<<
NumExceededMaxDepth
<<
" times
\n
"
);
delete
RecursionSeeds
;
RecursionSeeds
->
Delete
()
;
//
// Now that points and cells have been marked, traverse these lists pulling
// everything that has been visited.
...
...
@@ -165,9 +165,10 @@ void vtkConnectivityFilter::Execute()
// if coloring regions; send down new scalar data
if
(
this
->
ColorRegions
)
this
->
PointData
.
SetScalars
(
NewScalars
);
else
delete
NewScalars
;
NewScalars
->
Delete
()
;
this
->
SetPoints
(
newPts
);
newPts
->
Delete
();
//
// Create output cells
//
...
...
src/ContourF.cc
View file @
7e4b0f09
...
...
@@ -141,22 +141,19 @@ void vtkContourFilter::Execute()
// polys we've created, take care to reclaim memory.
//
this
->
SetPoints
(
newPts
);
newPts
->
Delete
();
this
->
PointData
.
SetScalars
(
newScalars
);
newScalars
->
Delete
();
if
(
newVerts
->
GetNumberOfCells
())
this
->
SetVerts
(
newVerts
);
else
delete
newVerts
;
if
(
newVerts
->
GetNumberOfCells
())
this
->
SetVerts
(
newVerts
);
newVerts
->
Delete
();
if
(
newLines
->
GetNumberOfCells
())
this
->
SetLines
(
newLines
);
else
delete
newLines
;
if
(
newLines
->
GetNumberOfCells
())
this
->
SetLines
(
newLines
);
newLines
->
Delete
();
if
(
newPolys
->
GetNumberOfCells
())
this
->
SetPolys
(
newPolys
);
else
delete
newPolys
;
if
(
newPolys
->
GetNumberOfCells
())
this
->
SetPolys
(
newPolys
);
newPolys
->
Delete
();
this
->
Squeeze
();
}
...
...
src/CubeSrc.cc
View file @
7e4b0f09
...
...
@@ -113,13 +113,17 @@ void vtkCubeSource::Execute()
pts
[
0
]
+=
4
;
pts
[
1
]
+=
4
;
pts
[
2
]
+=
4
;
pts
[
3
]
+=
4
;
newPolys
->
InsertNextCell
(
4
,
pts
);
//
// Update ourselves
// Update ourselves
and release memory
//
this
->
SetPoints
(
newPoints
);
newPoints
->
Delete
();
this
->
PointData
.
SetNormals
(
newNormals
);
newNormals
->
Delete
();
newPolys
->
Squeeze
();
// since we've estimated size; reclaim some space
this
->
SetPolys
(
newPolys
);
newPolys
->
Delete
();
}
void
vtkCubeSource
::
SetBounds
(
float
bounds
[
6
])
...
...
src/Cursor3D.cc
View file @
7e4b0f09
...
...
@@ -291,10 +291,13 @@ void vtkCursor3D::Execute()
}
}
//
// Update ourselves
// Update ourselves
and release memory
//
this
->
SetPoints
(
newPts
);
newPts
->
Delete
();
this
->
SetLines
(
newLines
);
newLines
->
Delete
();
}
// Description:
...
...
src/Cutter.cc
View file @
7e4b0f09
...
...
@@ -100,35 +100,20 @@ void vtkCutter::Execute()
// polys we've created, take care to reclaim memory.
//
this
->
SetPoints
(
newPoints
);
newPoints
->
Delete
();
if
(
newVerts
->
GetNumberOfCells
())
{
this
->
SetVerts
(
newVerts
);
}
else
{
delete
newVerts
;
}
if
(
newVerts
->
GetNumberOfCells
())
this
->
SetVerts
(
newVerts
);
newVerts
->
Delete
();
if
(
newLines
->
GetNumberOfCells
())
{
this
->
SetLines
(
newLines
);
}
else
{
delete
newLines
;
}
if
(
newLines
->
GetNumberOfCells
())
this
->
SetLines
(
newLines
);
newLines
->
Delete
();
if
(
newPolys
->
GetNumberOfCells
())
{
this
->
SetPolys
(
newPolys
);
}
else
{
delete
newPolys
;
}
if
(
newPolys
->
GetNumberOfCells
())
this
->
SetPolys
(
newPolys
);
newPolys
->
Delete
();
this
->
PointData
.
SetScalars
(
newScalars
);
newScalars
->
Delete
();
this
->
Squeeze
();
}
...
...
src/TenGlyph.cc
View file @
7e4b0f09
...
...
@@ -48,7 +48,7 @@ void vtkTensorGlyph::Execute()
int
inPtId
,
i
,
j
;
vtkPoints
*
sourcePts
;
vtkNormals
*
sourceNormals
;
vtkCellArray
*
sourceCells
;
vtkCellArray
*
sourceCells
,
*
cells
;
vtkFloatPoints
*
newPts
;
vtkFloatScalars
*
newScalars
=
NULL
;
vtkFloatNormals
*
newNormals
=
NULL
;
...
...
@@ -96,19 +96,27 @@ void vtkTensorGlyph::Execute()
// Setting up for calls to PolyData::InsertNextCell()
if
(
(
sourceCells
=
this
->
Source
->
GetVerts
())
->
GetNumberOfCells
()
>
0
)
{
this
->
SetVerts
(
new
vtkCellArray
(
numPts
*
sourceCells
->
GetSize
()));
cells
=
new
vtkCellArray
(
numPts
*
sourceCells
->
GetSize
());
this
->
SetVerts
(
cells
);
cells
->
Delete
();
}
if
(
(
sourceCells
=
this
->
Source
->
GetLines
())
->
GetNumberOfCells
()
>
0
)
{
this
->
SetLines
(
new
vtkCellArray
(
numPts
*
sourceCells
->
GetSize
()));
cells
=
new
vtkCellArray
(
numPts
*
sourceCells
->
GetSize
());
this
->
SetLines
(
cells
);
cells
->
Delete
();
}
if
(
(
sourceCells
=
this
->
Source
->
GetPolys
())
->
GetNumberOfCells
()
>
0
)
{
this
->
SetPolys
(
new
vtkCellArray
(
numPts
*
sourceCells
->
GetSize
()));
cells
=
new
vtkCellArray
(
numPts
*
sourceCells
->
GetSize
());
this
->
SetPolys
(
cells
);
cells
->
Delete
();
}
if
(
(
sourceCells
=
this
->
Source
->
GetStrips
())
->
GetNumberOfCells
()
>
0
)
{
this
->
SetStrips
(
new
vtkCellArray
(
numPts
*
sourceCells
->
GetSize
()));
cells
=
new
vtkCellArray
(
numPts
*
sourceCells
->
GetSize
());
this
->
SetStrips
(
cells
);
cells
->
Delete
();
}
// only copy scalar data through
...
...
@@ -242,8 +250,20 @@ void vtkTensorGlyph::Execute()
// Update ourselves
//
this
->
SetPoints
(
newPts
);
if
(
newScalars
)
this
->
PointData
.
SetScalars
(
newScalars
);
if
(
newNormals
)
this
->
PointData
.
SetNormals
(
newNormals
);
newPts
->
Delete
();
if
(
newScalars
)
{
this
->
PointData
.
SetScalars
(
newScalars
);
newScalars
->
Delete
();
}
if
(
newNormals
)
{
this
->
PointData
.
SetNormals
(
newNormals
);
newNormals
->
Delete
();
}
this
->
Squeeze
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment