Open lnicola opened 1 year ago
@lnicola Was going to replicate on MacOS. Can you share the input file?
It happens with every input, like the sample from https://github.com/ngageoint/GeoPackage/blob/master/docs/examples/java/example.gpkg.
Tested with the crates.io version, though.
FWIW, here's what I get from master
:
Running `.../georust-gdal/target/debug/examples/segfault ./example.gpkg`
Warning 1: Database relies on the 'nga_contents_id' (http://ngageoint.github.io/GeoPackage/docs/extensions/contents-id.html) extension that should be implemented in order to read it safely, but is not currently. Some data may be missing while reading that database.
Warning 1: Database relies on the 'nga_feature_tile_link' (http://ngageoint.github.io/GeoPackage/docs/extensions/feature-tile-link.html) extension that should be implemented in order to read it safely, but is not currently. Some data may be missing while reading that database.
Warning 1: Layer point1 relies on the 'nga_geometry_index' (http://ngageoint.github.io/GeoPackage/docs/extensions/geometry-index.html) extension that should be implemented in order to read it safely, but is not currently. Some data may be missing while reading that layer.
[examples/segfault.rs:9] feature = Feature {
_defn: Defn {
c_defn: 0x000060000304afd0,
},
c_feature: 0x00006000030763f0,
geometry: [
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/vector/geometry.rs:177:38
Not really the problem, but calling unwrap
seems like a bad idea?
@lnicola I wonder if this (foreign_types
) or something like it might be worth considering. I think we need some principled semantics around these GDAL pointers, Rust has all the type machinery we need, we just need to find good examples of how to do this properly or rely on a library that does it for us.
Still haven't looked into it, but I think we handle layers in a better way, that could serve as inspiration.
I have foreign_types
prototype here: https://github.com/georust/gdal/compare/master...metasim:gdal:prototype/foreign_types
Personally, once I converted a couple types, I really liked it (except the paucity of documentation), especially since it explicitly distinguishes owned vs. borrowed types. It's a very principled API. However, there would be several breaking changes.
Something like:
crashes with: