On Sep 5, 2006, at 5:40 PM, Josef Wolf wrote:

>
>   class Foo
>     def initialize
>       canvas = TkCanvas.new.pack
>       rect = TkcRectangle.new(canvas, 0, 0, 50, 50, "fill"=>"white")
>     end
>   end
>
>   begin
>     x=Foo.new()
>   end
>
>   GC.start
>
>   # Object destroyed but canvas and rectangle are still alive
>
>   Tk.mainloop
>
> I can't see a solution for this problem since I am a novice for  
> ruby/OO/Tk.
> How do you gurus handle such situations?

That just means that there is still a reference to those objects.  
When all the references go away, then and only then ruby will collect  
them (if it needs to.)