Class: Qt::MimeData

Inherits:
Object show all
Defined in:
lib/utilrb/qt/mime_data/mime_data.rb

Constant Summary collapse

@@saved_values =

prevents deleting the object until it get finalized by c++

Hash.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMimeData

Returns a new instance of MimeData


6
7
8
9
10
11
# File 'lib/utilrb/qt/mime_data/mime_data.rb', line 6

def initialize
    super
    ObjectSpace.define_finalizer self, MimeData::ruby_finalizer
    @@saved_values[self.object_id] ||= Set.new
    @@saved_values[self.object_id] << self
end

Class Method Details

.ruby_finalizerObject


13
14
15
# File 'lib/utilrb/qt/mime_data/mime_data.rb', line 13

def self.ruby_finalizer
    lambda { |id| @@saved_values.delete(id) }
end