Permalink
Browse files

Fix crash bug when destructing the H5AngReader class. (#858)

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
  • Loading branch information...
imikejackson committed Jan 7, 2019
1 parent fe9494d commit a541fada9117ae015a2a4c92b6af4fa97dd695e0
@@ -171,7 +171,6 @@ class EbsdLib_EXPORT EbsdReader
#if defined ( SIMPL_USE_SSE ) && defined ( __SSE2__ )
T* m_buffer = static_cast<T*>( _mm_malloc (numberOfElements * sizeof(T), 16) );
#else
//T* m_buffer = new T[numberOfElements];
T* m_buffer = static_cast<T*>(malloc(sizeof(T) * numberOfElements));
#endif
return m_buffer;
@@ -68,68 +68,7 @@ H5AngReader::H5AngReader()
// -----------------------------------------------------------------------------
H5AngReader::~H5AngReader()
{
float* fptr = nullptr;
int32_t* iptr = nullptr;
if(getPhi1Ownership())
{
fptr = getPhi1Pointer();
deallocateArrayData<float>(fptr);
setPhi1Pointer(nullptr);
}
if(getPhiOwnership())
{
fptr = getPhiPointer();
deallocateArrayData<float>(fptr);
setPhiPointer(nullptr);
}
if(getPhi1Ownership())
{
fptr = getPhi1Pointer();
deallocateArrayData<float>(fptr);
setPhi1Pointer(nullptr);
}
if(getImageQualityOwnership())
{
fptr = getImageQualityPointer();
deallocateArrayData<float>(fptr);
setImageQualityPointer(nullptr);
}
if(getConfidenceIndexOwnership())
{
fptr = getConfidenceIndexPointer();
deallocateArrayData<float>(fptr);
setConfidenceIndexPointer(nullptr);
}
if(getPhaseDataOwnership())
{
iptr = getPhaseDataPointer();
deallocateArrayData<int32_t>(iptr);
setPhaseDataPointer(nullptr);
}
if(getXPositionOwnership())
{
fptr = getXPositionPointer();
deallocateArrayData<float>(fptr);
setXPositionPointer(nullptr);
}
if(getYPositionOwnership())
{
fptr = getYPositionPointer();
deallocateArrayData<float>(fptr);
setYPositionPointer(nullptr);
}
if(getSEMSignalOwnership())
{
fptr = getSEMSignalPointer();
deallocateArrayData<float>(fptr);
setSEMSignalPointer(nullptr);
}
if(getFitOwnership())
{
fptr = getFitPointer();
deallocateArrayData<float>(fptr);
setFitPointer(nullptr);
}

}

// -----------------------------------------------------------------------------
@@ -470,7 +470,7 @@ void ImportH5EspritData::readDataFile(EbsdReader* ebsdReader, DataContainer* m,
data.phases = reader->getPhaseVector();
setFileCacheData(data);

std::array<int32_t, 2> patternDims = {0, 0};
std::array<int32_t, 2> patternDims = {{0, 0}};
reader->getPatternDims(patternDims);
QVector<int32_t> pDims(2);
pDims[0] = patternDims[0];

0 comments on commit a541fad

Please sign in to comment.