vtkStringArray Memory Exceptions
Environment of issue:
- Windows 10 Pro
- VTK v9.0.1
I've been using vtkStringArray in a programm of mine with the VTK v7.0.0 like so:
std::vector<std::string> fileList = Directory::ListAllFiles(dicomFolderPath, false);
std::vector<std::string> nonDICOMs;
vtkSmartPointer<vtkDICOMReader> findNonDICOMS = vtkSmartPointer<vtkDICOMReader>::New();
vtkStringArray* filesToRead = vtkStringArray::New();
for (int i = 0; i < fileList.size(); i++)
{
if (!findNonDICOMS->CanReadFile(fileList.at(i).c_str()))
{
nonDICOMs.push_back(fileList.at(i));
}
else
{
filesToRead->InsertNextValue(fileList.at(i));
}
}
fileList
is a std::vector<std::string>>
and I'm checking if the vtkDICOMReader can read all the files within this list.
With VTK v7.0.0 everything works as expected. After the code snippet I'll get a vtkStringArray filesToRead
containg all DICOMs readable by the vtkDICOMReader
.
Today I wanted to update VTK to v9.0.0 and suddenly vtkStringArray
throws exceptions when executing filesToRead->InsertNextValue(fileList.at(i))
.
Same exception can be reproduced with this small code snippet:
vtkStringArray* filenames = vtkStringArray::New();
std::string temp = "test";
filenames->InsertNextValue(temp);
I've also tried to instantiate the vtkStringArray
as a SmartPointer - same result.
Has something changed from v7.0.0 to v9.0.1 concerning the vtkStringArray`? Am I using it wrong - if so, why does it work with v7.0.0 and not in v9.0.1?
Sincerely, Philipp Weißenbacher