fxRuby: changing icon in TreeItem crashes

I would like to change the icon used by TreeItem in TreeList.
I'm using

  # Convenience function to load & construct an icon
  def makeIcon(filename)
    begin
      filename = File.join("icons", filename)
      icon = nil
      File.open(filename, "rb") { |f|
        icon = FXPNGIcon.new(getApp(), f.read)
      }
      icon
    rescue
      raise RuntimeError, "Couldn't load icon: #{filename}"
    end
  end

...

  doc = makeIcon("minidoc.png")
  @tree.currentItem.text = "new icon coming ..."
  @tree.currentItem.closedIcon = doc # crash!

I had no problem adding icons when the TreeItem was constructed.

I'm using fox14.

Christer

···

--
Posted via http://www.ruby-forum.com/.