diff --git a/gcore/gdal_priv.h b/gcore/gdal_priv.h index dcb80a3f203e..421367884f0a 100644 --- a/gcore/gdal_priv.h +++ b/gcore/gdal_priv.h @@ -1625,7 +1625,7 @@ class CPL_DLL GDALRasterBand : public GDALMajorObject void InitRWLock(); void SetValidPercent(GUIntBig nSampleCount, GUIntBig nValidCount); - mutable std::unique_ptr m_oPointsCache{}; + mutable GDALDoublePointsCache *m_poPointsCache = nullptr; //! @endcond diff --git a/gcore/gdalrasterband.cpp b/gcore/gdalrasterband.cpp index 651051edb2c9..3d522db99d7c 100644 --- a/gcore/gdalrasterband.cpp +++ b/gcore/gdalrasterband.cpp @@ -107,6 +107,8 @@ GDALRasterBand::~GDALRasterBand() InvalidateMaskBand(); nBand = -nBand; + + delete m_poPointsCache; } /************************************************************************/ @@ -9398,11 +9400,11 @@ CPLErr GDALRasterBand::InterpolateAtPoint(double dfPixel, double dfLine, } GDALRasterBand *pBand = const_cast(this); - if (!m_oPointsCache) - m_oPointsCache = std::make_unique(); + if (!m_poPointsCache) + m_poPointsCache = new GDALDoublePointsCache(); const bool res = - GDALInterpolateAtPoint(pBand, eInterpolation, m_oPointsCache->cache, + GDALInterpolateAtPoint(pBand, eInterpolation, m_poPointsCache->cache, dfPixel, dfLine, pdfRealValue, pdfImagValue); return res ? CE_None : CE_Failure;