Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
91c7c3c6
Commit
91c7c3c6
authored
Aug 08, 2007
by
Dave Demarle
Browse files
BUG: Plug a memory leak that showed up when valid selections with empty id lists were passed in.
parent
bdafa8f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Graphics/vtkExtractSelectedIds.cxx
View file @
91c7c3c6
...
...
@@ -32,7 +32,7 @@
#include "vtkStdString.h"
#include "vtkUnstructuredGrid.h"
vtkCxxRevisionMacro
(
vtkExtractSelectedIds
,
"1.2
1
"
);
vtkCxxRevisionMacro
(
vtkExtractSelectedIds
,
"1.2
2
"
);
vtkStandardNewMacro
(
vtkExtractSelectedIds
);
//----------------------------------------------------------------------------
...
...
@@ -346,7 +346,6 @@ int vtkExtractSelectedIds::ExtractCells(
{
//no global array, so just use the input cell index
labelArray
=
idxArray
;
labelArray
->
Register
(
NULL
);
}
// Reverse the "in" flag
...
...
@@ -378,12 +377,32 @@ int vtkExtractSelectedIds::ExtractCells(
if
(
idArray
==
NULL
)
{
idxArray
->
Delete
();
idList
->
Delete
();
if
(
ptIds
)
{
ptIds
->
Delete
();
}
if
(
cellCounter
)
{
delete
[]
cellCounter
;
}
return
1
;
}
// Array types must match
if
(
idArray
->
GetDataType
()
!=
labelArray
->
GetDataType
())
{
idxArray
->
Delete
();
idList
->
Delete
();
if
(
ptIds
)
{
ptIds
->
Delete
();
}
if
(
cellCounter
)
{
delete
[]
cellCounter
;
}
vtkWarningMacro
(
"array types don't match"
);
return
0
;
}
...
...
@@ -509,10 +528,7 @@ int vtkExtractSelectedIds::ExtractCells(
}
}
if
(
idArray
)
{
idArray
->
Delete
();
}
idArray
->
Delete
();
if
(
invert
)
{
...
...
@@ -532,7 +548,6 @@ int vtkExtractSelectedIds::ExtractCells(
idList
->
Delete
();
idxArray
->
Delete
();
labelArray
->
Delete
();
if
(
!
passThrough
)
{
...
...
@@ -677,18 +692,11 @@ int vtkExtractSelectedIds::ExtractPoints(
vtkIdList
*
cellPts
=
vtkIdList
::
New
();
vtkIdType
numIds
=
0
,
ptId
,
cellId
,
idArrayIndex
=
0
,
labelArrayIndex
=
0
;
vtkAbstractArray
*
idArray
=
sel
->
GetSelectionList
();
if
(
idArray
)
{
numIds
=
idArray
->
GetNumberOfTuples
();
vtkAbstractArray
*
sortedArray
=
vtkAbstractArray
::
CreateArray
(
idArray
->
GetDataType
());
sortedArray
->
DeepCopy
(
idArray
);
vtkSortDataArray
::
SortArrayByComponent
(
sortedArray
,
0
);
idArray
=
sortedArray
;
}
if
(
idArray
==
NULL
)
{
idxArray
->
Delete
();
ptCells
->
Delete
();
cellPts
->
Delete
();
return
1
;
}
...
...
@@ -696,9 +704,19 @@ int vtkExtractSelectedIds::ExtractPoints(
if
(
idArray
->
GetDataType
()
!=
labelArray
->
GetDataType
())
{
vtkWarningMacro
(
"array types don't match"
);
idxArray
->
Delete
();
ptCells
->
Delete
();
cellPts
->
Delete
();
return
0
;
}
numIds
=
idArray
->
GetNumberOfTuples
();
vtkAbstractArray
*
sortedArray
=
vtkAbstractArray
::
CreateArray
(
idArray
->
GetDataType
());
sortedArray
->
DeepCopy
(
idArray
);
vtkSortDataArray
::
SortArrayByComponent
(
sortedArray
,
0
);
idArray
=
sortedArray
;
void
*
idVoid
=
idArray
->
GetVoidPointer
(
0
);
void
*
labelVoid
=
labelArray
->
GetVoidPointer
(
0
);
...
...
@@ -822,10 +840,7 @@ int vtkExtractSelectedIds::ExtractPoints(
}
}
if
(
idArray
)
{
idArray
->
Delete
();
}
idArray
->
Delete
();
ptCells
->
Delete
();
cellPts
->
Delete
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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