From 1f39b05923a8902cb54d268ee950b0b5c6032643 Mon Sep 17 00:00:00 2001 From: Lucio Asnaghi Date: Fri, 8 May 2009 21:45:19 +0000 Subject: [PATCH] + add GDALDereferenceDataset when used with GDALOpenShared (instead of freeing brutally the dataset) --- plugins/input/gdal/gdal_datasource.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index ae4e44a5a..05835a9da 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -43,6 +43,7 @@ gdal_datasource::gdal_datasource(parameters const& params) desc_(*params.get("type"),"utf-8") { GDALAllRegister(); + boost::optional file = params.get("file"); if (!file) throw datasource_exception("missing parameter"); @@ -64,7 +65,11 @@ gdal_datasource::gdal_datasource(parameters const& params) extent_.init(x0,y0,x1,y1); } -gdal_datasource::~gdal_datasource() {} +gdal_datasource::~gdal_datasource() +{ + GDALDereferenceDataset (dataset_.get()); + dataset_.reset(); // prevent delete of dataset +} int gdal_datasource::type() const {