Opened 11 years ago

Closed 11 years ago

#2259 closed defect (fixed)

OGRSFDriver.Open methods do not always call DataSource.SetDriver

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


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 (1)

comment:1 Changed 11 years ago by warmerdam

Keywords: driver added
Milestone: 1.5.1
Resolution: fixed
Status: newclosed

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.