diff options
-rw-r--r-- | lib/efl/ecore.rb | 11 | ||||
-rw-r--r-- | spec/ecore_spec.rb | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/efl/ecore.rb b/lib/efl/ecore.rb index b4d8aaa..4938651 100644 --- a/lib/efl/ecore.rb +++ b/lib/efl/ecore.rb @@ -17,9 +17,16 @@ module Efl # class REcorePipe def initialize cb, data - @ptr = Efl::Ecore.ecore_pipe_add cb, data + @ptr = FFI::AutoPointer.new Efl::Ecore.ecore_pipe_add(cb, data), REcorePipe.method(:release) + end + def self.release p + Efl::Ecore.ecore_pipe_del p + end + def del + @ptr.autorelease=false + REcorePipe.release @ptr + @ptr=nil end - def del; Efl::Ecore.ecore_pipe_del @ptr; end def read_close; Efl::Ecore.ecore_pipe_read_close @ptr; end def write_close; Efl::Ecore.ecore_pipe_write_close @ptr; end def write data diff --git a/spec/ecore_spec.rb b/spec/ecore_spec.rb index 58a5387..6633156 100644 --- a/spec/ecore_spec.rb +++ b/spec/ecore_spec.rb @@ -55,7 +55,7 @@ describe Efl::Ecore do Ecore.main_loop_iterate pipe.read_close pipe.write_close - pipe.del.address.should == data.address + pipe.del Ecore.shutdown end # |