gogeos icon indicating copy to clipboard operation
gogeos copied to clipboard

geom: avoid racing with GC when calling Coords() on shell/hole

Open pmezard opened this issue 8 years ago • 0 comments

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

pmezard avatar Jan 10 '17 14:01 pmezard