require 'phi'
include  Phi

form = Form.new
button1 = Button.new(form, :button1, "i am first button")
button1.align = AL_TOP

button2 = Button.new(form, :button2, "kill first button")
button2.align = AL_BOTTOM

button2.on_click = proc do |sender|
  unless button1.nil?
    button1.parent.instance_eval{ @button1 = nil }
    button1 = nil
  end
  GC.start						#hey, i don't know perhaps this helps
  ObjectSpace.each_object(Button) do |button|
    puts button					#...button1 still there
  end
end

form.show
Phi.mainloop
