<div dir="ltr">Hi all,<div><br></div><div>I've written some C code (in one of Fiona's extension modules) that</div><div><br></div><div>1. sets a OGRSpatialReferenceH using OSRSetFromUserInput()</div><div>2. passes this OGRSpatialReferenceH to GDALDatasetCreateLayer()</div><div>3. frees the OGRSpatialReferenceH using OSRDestroySpatialReference()</div><div>4. adds feature definitions and features to the layer</div><div>4. calls GDALClose() on the layer's dataset</div><div><br></div><div>When using the Shapefile driver, this code always works. When using the GPKG driver on Mac OS X and Windows (reports at <a href="https://github.com/Toblerity/Fiona/issues/441">https://github.com/Toblerity/Fiona/issues/441</a>) sporadic crashes occur in OGRSpatialReference::Release() as the dataset is closed and the table, feature definition, and geometry field definition is torn down.</div><div><br></div><div>Does a created layer take ownership of the OGRSpatialReferenceH? What's the difference in the implementation of Shapefile and GPKG layers?</div><div><br></div><div>Thanks in advance!</div><div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Sean Gillies</div></div>
</div></div>