Skip to content
Permalink
Browse files

The return value of CPLGetConfigOption() is volatile, and can be

invalidated by a following call to CPLSetConfigOption(). Thus it needs
to be duplicated.
  • Loading branch information
rouault committed Sep 28, 2012
1 parent 40b60bb commit 82a22f08861b9030574fd1b552ef7289f739a01d
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/providers/gdal/qgsgdalprovider.cpp
@@ -1377,7 +1377,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
}

// are we using Erdas Imagine external overviews?
const char* myConfigUseRRD = CPLGetConfigOption( "USE_RRD", "NO" );
char* myConfigUseRRD = strdup(CPLGetConfigOption( "USE_RRD", "NO" ));
if ( theFormat == PyramidsErdas )
CPLSetConfigOption( "USE_RRD", "YES" );
else
@@ -1471,6 +1471,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
//emit drawingProgress( 0, 0 );
// restore former USE_RRD config (Erdas)
CPLSetConfigOption( "USE_RRD", myConfigUseRRD );
free(myConfigUseRRD);
return "FAILED_NOT_SUPPORTED";
}
else
@@ -1487,6 +1488,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste

// restore former USE_RRD config (Erdas)
CPLSetConfigOption( "USE_RRD", myConfigUseRRD );
free(myConfigUseRRD);

QgsDebugMsg( "Pyramid overviews built" );

0 comments on commit 82a22f0

Please sign in to comment.
You can’t perform that action at this time.