Subject:
Re: [ruby-ffi] Finding a segfault on GC
From:
Wayne Meissner
Date:
12/9/10 11:25 PM
To:
ruby-ffi@googlegroups.com

On 10 December 2010 12:21, dark.panda <dark.panda@gmail.com> wrote:

> Anyone have any ideas as to what's going on? I'm at my wits end at
> this point. Modifying GEOS itself might not be an option, but if
> there's something I can do in Ruby that would be awesome.

I haven't looked in depth, but in that cut down gist, it _could_ be this:

handle = FFIGeos.initGEOS_r(
  self.method(:notice_handler),
  self.method(:error_handler)
)

Stash the return values from self.method() somewhere.
e.g.

@nh = self.method(:notice_handler)
@eh = self.method(:error_handler)
handle = FFIGeos.initGEOS_r(@nh, @eh))

They don't have to be ivars, but they need to be kept for as long as
Geos needs to use the callbacks.