[Gdal-dev] OGRClose()
Ivan Lucena
ILucena at clarku.edu
Thu May 18 15:57:14 EDT 2006
Hi There,
In the link bellow there is a very good piece of advice about closing a
GDAL DataSet. But there is nothing similar in the OGR API, so in order
to "close" a DataSource ogrinfo calls the same "delete" operator.
Doesn't it need to follow the same safety rules?
Anyway, as I am accessing the DLL from another programming environment
it will be better to have an OGRClose() to call. The memory managements
are incompatible and I can't call the correlated version of "delete".
Does it make any sense? I mean, did I express myself clear enough?
I can migrated my very small piece of code to C and forget about it, but
that problem looks kind of scary to me.
Ivan
Reference:
"Closing the Dataset
Please keep in mind that GDALRasterBand objects are owned by their
dataset, and they should never be destroyed with the C++ delete
operator. GDALDataset's can be closed either by calling GDALClose() or
using the delete operator on the GDALDataset. Either will result in
proper cleanup, and flushing of any pending writes."
[http://www.gdal.org/gdal_tutorial.html]
"
/* --------------------------------------------------------------------
*/
/* Close down.
*/
/* --------------------------------------------------------------------
*/
CSLDestroy( papszArgv );
CSLDestroy( papszLayers );
delete poDS;"
[ogrinfo.cpp from line
377:]
More information about the Gdal-dev
mailing list