@@ -1448,11 +1448,6 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
1448
1448
QgsGdalProgress myProg;
1449
1449
myProg.type = ProgressPyramids;
1450
1450
myProg.provider = this ;
1451
- // Observed problem: if a *.rrd file exists and GDALBuildOverviews() is called,
1452
- // the *.rrd is deleted and no overviews are created, if GDALBuildOverviews()
1453
- // is called next time, it crashes somewhere in GDAL:
1454
- // https://trac.osgeo.org/gdal/ticket/4831
1455
- // Crash can be avoided if dataset is reopened
1456
1451
myError = GDALBuildOverviews ( mGdalBaseDataset , theMethod,
1457
1452
myOverviewLevelsVector.size (), myOverviewLevelsVector.data (),
1458
1453
0 , NULL ,
@@ -1492,8 +1487,16 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
1492
1487
1493
1488
QgsDebugMsg ( " Pyramid overviews built" );
1494
1489
1495
- // For now always reopen to avoid crash described above
1496
- if ( true || theFormat == PyramidsInternal )
1490
+ // Observed problem: if a *.rrd file exists and GDALBuildOverviews() is called,
1491
+ // the *.rrd is deleted and no overviews are created, if GDALBuildOverviews()
1492
+ // is called next time, it crashes somewhere in GDAL:
1493
+ // https://trac.osgeo.org/gdal/ticket/4831
1494
+ // Crash can be avoided if dataset is reopened, fixed in GDAL 1.9.2
1495
+ #if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1920
1496
+ if ( theFormat == PyramidsInternal )
1497
+ #else
1498
+ if ( true ) // GDAL #4831 fix
1499
+ #endif
1497
1500
{
1498
1501
QgsDebugMsg ( " Reopening dataset ..." );
1499
1502
// close the gdal dataset and reopen it in read only mode
0 commit comments