Skip to content

Commit

Permalink
The return value of CPLGetConfigOption() is volatile, and can be
Browse files Browse the repository at this point in the history
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 82a22f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/providers/gdal/qgsgdalprovider.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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" );

Expand Down

0 comments on commit 82a22f0

Please sign in to comment.