Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FFI] FFI::AutoPointer#free causes FFI::AutoPointer#autorelease? to cast NullPointerException #654

Burgestrand opened this issue Apr 24, 2013 · 0 comments


Copy link

@Burgestrand Burgestrand commented Apr 24, 2013

require "ffi"

class Releasable < FFI::AutoPointer
  def self.release(pointer)
    puts "Release"
    # no op

p =
r =
p r.autorelease? # => NullPointerException

It’s because when AutoPointer#free is called, the reaper (managed for releasing the pointer) is reassigned to null. This causes AutoPointer#autorelease? to fail, since reaper is now no longer.

@ghost ghost closed this in c253096 Apr 24, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant