Class: GLib::DestroyNotify

Inherits:
Object
  • Object
show all
Defined in:
lib/ffi-glib/destroy_notify.rb

Overview

Overrides for DestroyNotify, the callback type for destroy notifications. It should not be necessary to create objects of this class from Ruby directly.

Class Method Summary collapse

Class Method Details

.defaultObject

Return the default DestroyNotify object used when calling functions that take a DestroyNotify argument.

GirFFI uses a singleton object here to ensure it will always exist when called from the C side.

This assumes ClosureToPointerConvertor creates code store the callbacak to be destroyed using ArgHelper.store.



18
19
20
21
22
23
# File 'lib/ffi-glib/destroy_notify.rb', line 18

def self.default
  @default ||= from proc { |user_data|
    callback = GirFFI::ArgHelper::OBJECT_STORE.fetch(user_data)
    drop_callback callback
  }
end