From 191776fbec767dc3f670e1776ee71745cc0bd75f Mon Sep 17 00:00:00 2001 From: groogy Date: Thu, 25 Nov 2010 17:52:50 +0000 Subject: [PATCH] Made some changes to ensure consistency with references when it comes to the Garbage Collector git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1713 4e206d99-4929-0410-ac5d-dfc041789085 --- bindings/ruby/sfml-graphics/graphics/Font.cpp | 2 +- bindings/ruby/sfml-graphics/graphics/RenderImage.cpp | 1 + bindings/ruby/sfml-graphics/graphics/RenderTarget.cpp | 2 ++ bindings/ruby/sfml-window/window/Window.cpp | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bindings/ruby/sfml-graphics/graphics/Font.cpp b/bindings/ruby/sfml-graphics/graphics/Font.cpp index 14b9bbf16..519af615d 100644 --- a/bindings/ruby/sfml-graphics/graphics/Font.cpp +++ b/bindings/ruby/sfml-graphics/graphics/Font.cpp @@ -126,7 +126,7 @@ static VALUE Font_GetImage( VALUE self, VALUE aCharacterSize ) Data_Get_Struct( self, sf::Font, object ); const sf::Image& image = object->GetImage( FIX2UINT( aCharacterSize ) ); VALUE rbImage = Data_Wrap_Struct( globalImageClass, 0, 0, const_cast( &image ) ); - rb_iv_set( rbImage, "@__owner__", self ); + rb_iv_set( rbImage, "@__owner_ref", self ); return rbImage; } diff --git a/bindings/ruby/sfml-graphics/graphics/RenderImage.cpp b/bindings/ruby/sfml-graphics/graphics/RenderImage.cpp index 05f6d5457..818bd1da4 100644 --- a/bindings/ruby/sfml-graphics/graphics/RenderImage.cpp +++ b/bindings/ruby/sfml-graphics/graphics/RenderImage.cpp @@ -160,6 +160,7 @@ static VALUE RenderImage_GetImage( VALUE self ) const sf::Image &image = object->GetImage(); VALUE rbData = Data_Wrap_Struct( globalImageClass, 0, 0, const_cast< sf::Image * >( &image ) ); rb_obj_call_init( rbData, 0, 0 ); + rb_iv_set( rbData, "@__owner_ref", self ); return rbData; } diff --git a/bindings/ruby/sfml-graphics/graphics/RenderTarget.cpp b/bindings/ruby/sfml-graphics/graphics/RenderTarget.cpp index 86d543bcc..dc20b0d5d 100644 --- a/bindings/ruby/sfml-graphics/graphics/RenderTarget.cpp +++ b/bindings/ruby/sfml-graphics/graphics/RenderTarget.cpp @@ -167,6 +167,7 @@ static VALUE RenderTarget_GetView( VALUE self ) const sf::View &view = object->GetView(); VALUE rbData = Data_Wrap_Struct( globalViewClass, 0, 0, const_cast< sf::View * >( &view ) ); rb_obj_call_init( rbData, 0, 0 ); + rb_iv_set( rbData, "@__owner_ref", self ); return rbData; } @@ -184,6 +185,7 @@ static VALUE RenderTarget_GetDefaultView( VALUE self ) const sf::View &view = object->GetDefaultView(); VALUE rbData = Data_Wrap_Struct( globalViewClass, 0, 0, const_cast< sf::View * >( &view ) ); rb_obj_call_init( rbData, 0, 0 ); + rb_iv_set( rbData, "@__owner_ref", self ); return rbData; } diff --git a/bindings/ruby/sfml-window/window/Window.cpp b/bindings/ruby/sfml-window/window/Window.cpp index 7a6809217..a892d9205 100644 --- a/bindings/ruby/sfml-window/window/Window.cpp +++ b/bindings/ruby/sfml-window/window/Window.cpp @@ -221,6 +221,7 @@ static VALUE Window_GetInput( VALUE self ) Data_Get_Struct( self, sf::Window, object ); VALUE rbData = Data_Wrap_Struct( globalInputClass, 0, 0, const_cast< sf::Input * >( &object->GetInput() ) ); rb_obj_call_init( rbData, 0, 0 ); + rb_iv_set( rbData, "@__owner_ref", self ); return rbData; } @@ -238,6 +239,7 @@ static VALUE Window_GetSettings( VALUE self ) Data_Get_Struct( self, sf::Window, object ); VALUE rbData = Data_Wrap_Struct( globalContextSettingsClass, 0, 0, const_cast( &object->GetSettings() ) ); rb_obj_call_init( rbData, 0, 0 ); + rb_iv_set( rbData, "@__owner_ref", self ); return rbData; }