Closed brendan-ward closed 2 months ago
I'm perhaps hijacking this PR a bit but just to mention that starting with GDAL 3.7, GDALClose() returns a CPLErr return code (previously was void). This can be a way of checking that everything has been successfullly written (some formats completely defer writing at close time). Cf https://gdal.org/development/rfc/rfc91_dataset_close.html
Resolves #394
This reorganizes the write functions a bit to make sure that we're always cleaning up allocated objects (feature, geometry, etc) in the
finally
block in case of exception, which reduces the amount of innertry
/catch
blocks we need to have. This should then correctly release those within the loops under the non-exception path.This also strips out the
OGRReleaseDataSource
we were using in various places forGDALClose
, which is the current recommended function.