Closed asg017 closed 2 months ago
Hi Alex! I'm glad to hear you're having fun with the library. You are definitely using the library correctly. I was able to reproduce the bug on my side and I just pushed a fix.
As for lifetimes, the thing to remember is that any geometry created from _new_
or _parse_
should eventually be freed at some point using tg_geom_free
. Geometries that are passed into a new or parse function is simply borrowed using a reference counter. Ownership of those input geometries is never taken by those functions.
Thank you Josh, really appreciate the fast response! Can confirm that commit fixes my issue.
Hey @tidwall ! First off thanks a ton for all your work on this library, I'm building a SQLite extension around it, and it's been an absolute blast!
I found a segfault when using the output of
tg_geom_new_geometrycollection()
, specifically when building a collection around polygons. Here's a minimal repro:Output:
If I run with a sanitizer, I get this:
Let me know if you need anything else to repro! Happy to provide compiler info/flags as needed. I also know that I may be using
tg_geom_new_geometrycollection()
incorrectly, the lifetime requirements are a bit tough to understand, so please let me know if I'm using it wrong.