[fdo-commits] r98 - branches/3.2.x/Providers/GDAL/Src/Provider
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Thu Feb 22 22:03:59 EST 2007
Author: warmerdam
Date: 2007-02-22 22:03:57 -0500 (Thu, 22 Feb 2007)
New Revision: 98
Modified:
branches/3.2.x/Providers/GDAL/Src/Provider/FdoRfpDatasetCache.cpp
branches/3.2.x/Providers/GDAL/Src/Provider/FdoRfpGeoRasterExtractor.cpp
Log:
fix serious reference counting bugs (ticket #14)
Modified: branches/3.2.x/Providers/GDAL/Src/Provider/FdoRfpDatasetCache.cpp
===================================================================
--- branches/3.2.x/Providers/GDAL/Src/Provider/FdoRfpDatasetCache.cpp 2007-02-23 02:45:58 UTC (rev 97)
+++ branches/3.2.x/Providers/GDAL/Src/Provider/FdoRfpDatasetCache.cpp 2007-02-23 03:03:57 UTC (rev 98)
@@ -114,6 +114,9 @@
// Add our new handle at the beginning of the list.
pahDatasetList[nDatasetCount++] = hDS;
+ // Take a reference on behalf of the caller.
+ GDALReferenceDataset( hDS );
+
return hDS;
}
@@ -155,7 +158,7 @@
for( iDS = nDatasetCount-1; iDS >= 0; iDS-- )
{
GDALReferenceDataset( pahDatasetList[iDS] );
- if( GDALDereferenceDataset( pahDatasetList[iDS] ) == 1 )
+ if( GDALDereferenceDataset( pahDatasetList[iDS] ) <= 1 )
CloseDataset( iDS );
}
}
@@ -166,5 +169,14 @@
int iDS;
for( iDS = nDatasetCount-1; iDS >= 0; iDS-- )
+ {
+ GDALReferenceDataset( pahDatasetList[iDS] );
+ if( GDALDereferenceDataset( pahDatasetList[iDS] ) > 1 )
+ CPLDebug( "RfpDatasetCache::CloseAll()",
+ "Forcing closure of %s even though there\n"
+ "are still references against it.",
+ GDALGetDescription( pahDatasetList[iDS] ) );
+
CloseDataset( iDS );
+ }
}
Modified: branches/3.2.x/Providers/GDAL/Src/Provider/FdoRfpGeoRasterExtractor.cpp
===================================================================
--- branches/3.2.x/Providers/GDAL/Src/Provider/FdoRfpGeoRasterExtractor.cpp 2007-02-23 02:45:58 UTC (rev 97)
+++ branches/3.2.x/Providers/GDAL/Src/Provider/FdoRfpGeoRasterExtractor.cpp 2007-02-23 03:03:57 UTC (rev 98)
@@ -187,7 +187,10 @@
// if there is no georeference associated, just ignore this image.
if (FdoRfpRasterUtil::GetGeoReferenceInfo(hDS, geoRef) == false)
+ {
+ datasetCache->UnlockDataset( hDS );
continue;
+ }
datasetCache->UnlockDataset( hDS );
More information about the fdo-commits
mailing list