gogeos
gogeos copied to clipboard
geom: avoid racing with GC when calling Coords() on shell/hole
The problem is twofold:
- In Geometry.Coords() we have to make sure the parent Geometry outlives the processing of the coordinates array.
- The previous condition is not enough when the geometry comes from Shell() or Holes(), which return internal objects. We have to make sure the shell/hole parent geometry outlives the shell/hole instance.
The fix is similar to the one suggested in #11. There are probably a lot of places where either previous conditions are required, I have not checked all the code.
Note: this change the minimum required Go version to 1.7. I tried to play build tag games to have empty versions of the runtime.KeepAlive call, and failed.
Fixes #8