raku-community-modules / GD

Raku interface to the Gd graphics library.
Artistic License 2.0
2 stars 6 forks source link

Segfault on `close` if file not opened #7

Closed jonathanstowe closed 4 years ago

jonathanstowe commented 4 years ago

If the GD::File returned by e.g. $image.open wasn't actually successfully opened (but is returned regardless,) then calling close on it will result in a segfault.

This manifests when e.g. the examples/polygon.p6 is run from the root directory (so the images sub-directory doesn't exist.)

I think two things need to happen:

It may be possible to get around both of these by using IO::Handle everywhere and .native-descriptor (possibly with with fdopen ) to pass to the native functions.