Skip to content
Snippets Groups Projects
Commit 3bfa23c8 authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

BUG: close GDAL/OGRDataSource with properly

parent 4d2cf292
No related branches found
No related tags found
No related merge requests found
......@@ -19,10 +19,10 @@
#define __otbOGRVectorDataIO_h
#include <string>
#include <cassert>
#include "otbVectorDataIOBase.h"
#include "otbVectorData.h"
#include "otbOGRVersionProxy.h"
namespace otb
......@@ -116,6 +116,8 @@ private:
std::string GetOGRDriverName(std::string name) const;
void OGRVectorDataIO::CloseInternalDataSource();
ogr::version_proxy::GDALDatasetType * m_DataSource;
};
......
......@@ -46,7 +46,7 @@ OGRVectorDataIO::~OGRVectorDataIO()
{
if (m_DataSource != NULL)
{
otb::ogr::version_proxy::Close(m_DataSource);
this->CloseInternalDataSource();
}
}
......@@ -90,7 +90,7 @@ OGRVectorDataIO
if (m_DataSource != NULL)
{
ogr::version_proxy::Close(m_DataSource);
this->CloseInternalDataSource();
}
m_DataSource = ogr::version_proxy::Open(this->m_FileName.c_str(),true);
......@@ -178,7 +178,13 @@ OGRVectorDataIO
} // end For each layer
GDALClose(m_DataSource);
this->CloseInternalDataSource();
}
void OGRVectorDataIO::CloseInternalDataSource()
{
assert(m_DataSource != NULL && "m_DataSource cannot be NULL");
ogr::version_proxy::Close(m_DataSource);
m_DataSource = NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment