Ticket #2259 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

OGRSFDriver.Open methods do not always call DataSource.SetDriver

Reported by: ajolma Owned by: warmerdam
Priority: normal Milestone: 1.5.1
Component: OGR_SF Version: unspecified
Severity: normal Keywords: driver
Cc:

Description

For example Open() in ogrshapedriver.cpp does not call poDS-SetDriver? nor it is done in OGR_Dr_Open in ogrsfdriver.cpp. This leaves the driver undefined for datasources opened in this way. Open in ogrsfdriverregistrar.cpp works ok as it sets poDS->m_poDriver = poDriver;

I haven't checked all drivers, at least shapefile driver is buggy in this respect. Fixing this in OGR_Dr_Open would fix it only for the C API, but perhaps that would be enough?

Change History

Changed 5 years ago by warmerdam

  • keywords driver added
  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.5.1

I hadn't really considered the Open() method as something that should be called by anyone but the driver registrar. However, on reflection I can't think of any reason to restrict it.

I have modified OGR_Dr_Open() to set the driver in trunk (r13932) and 1.5 branch (r13933).

It is not very practical to change the driver implementation "contract" at this point, so we can't expected driver implementations to take care of setting the driver on a datasource. I have documented the limitation of the OGRSFDriver::Open() method in trunk (r13934).

Note, essentially all drivers will have this issue.

Note: See TracTickets for help on using tickets.