Gtk Dialog window hangs around

Hi Folks,

I'm doing a project that makes quite a bit of use of Gtk::Dialogs.
They are not called from within a parent window, just from within a
normal Ruby app like so:

      self.check(options)
      Gtk.init
      self.build(options)
      dialog = Gtk::MessageDialog.new(
        nil,
        Gtk::Dialog::MODAL,
        options[:type],
        options[:buttons],
        options[:text].to_s)
      options[:title] ? dialog.set_title(options[:title]) : nil
      dialog.signal_connect("delete_event"){Gtk.main_quit}

      result = nil
      dialog.run do |response|
        case response
        when Gtk::Dialog::RESPONSE_OK:
          result = true
        when Gtk::Dialog::RESPONSE_CANCEL:
          result = false
        end
      end
      dialog.destroy
      return result

The problem I am having is that the window containing the dialog does
not disappear after the dialog.run call is finished. It becomes a
blank grey square and if you close it with the window manager it kills
the entire process. Is it not possible to use Gtk::Dialog nicely
outside of a pre-existing Gtk window?

Thanks,
Farrel

      dialog.signal_connect("delete_event"){Gtk.main_quit}

Ignore this line it's been taken out but the blank window is still persisting...