summaryrefslogtreecommitdiffstats
path: root/lib/efl
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-02 23:46:49 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-02 23:46:49 +0200
commita4bcdf9905fcfd4ddd97dcb49a327b963986f9dc (patch)
tree6727a327beb3829a9f421c801581ee06602ae535 /lib/efl
parentedd4c24ff2c0a5cf62a32e742010eb47574b5abb (diff)
downloadffi-efl-a4bcdf9905fcfd4ddd97dcb49a327b963986f9dc.zip
ffi-efl-a4bcdf9905fcfd4ddd97dcb49a327b963986f9dc.tar.gz
evas : cleanup REvas#initialize and REvasObject#initialize, update specs
Diffstat (limited to 'lib/efl')
-rw-r--r--lib/efl/evas.rb35
1 files changed, 16 insertions, 19 deletions
diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb
index 3ecdf29..cba94ce 100644
--- a/lib/efl/evas.rb
+++ b/lib/efl/evas.rb
@@ -50,22 +50,21 @@ module Efl
@ptr = (
case o
when NilClass
- FFI::AutoPointer.new Efl::Evas.evas_new, method(:free)
- when self.class
- o.to_ptr
- when FFI::AutoPointer
- o
+ FFI::AutoPointer.new Efl::Evas.evas_new, REvas.method(:release)
when FFI::Pointer
- FFI::AutoPointer.new o, method(:free)
+ o
else
raise ArgumentError.new "wrong argument #{o.class.name}"
end
)
yield self if block_given?
end
- def free p=nil
- return Efl::Evas.evas_free p unless p.nil?
- Efl::Evas.evas_free @ptr
+ def self.release p
+ Efl::Evas.evas_free p unless p.nil?
+ end
+ def free
+ @ptr.autorelease=false if @ptr.is_a? FFI::AutoPointer
+ REvas.release @ptr
@ptr=nil
end
def object_add t
@@ -108,23 +107,21 @@ module Efl
@ptr = (
case o
when NilClass
- FFI::AutoPointer.new Efl::Evas.evas_new, method(:free)
- when self.class
- o.to_ptr
- when FFI::AutoPointer
- o
+ FFI::AutoPointer.new Efl::Evas.evas_new, REvasObject.method(:release)
when FFI::Pointer
- FFI::AutoPointer.new o, method(:free)
+ o
else
raise ArgumentError.new "wrong argument #{o.class.name}"
end
)
yield self if block_given?
end
- def free p=nil
- return Efl::Evas.evas_object_del p unless p.nil?
- Efl::Evas.evas_object_del @ptr
- @ptr.free
+ def self.release p
+ Efl::Evas.evas_object_del p unless p.nil?
+ end
+ def free
+ @ptr.autopointer=false if @ptr.is_a? FFI::AutoPointer
+ REvasObject.release @ptr
@ptr=nil
end
def geometry_get