Forum: Ruby-Gnome 2 Crash in GtkFileChooser

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Daniel L. (Guest)
on 2009-04-24 11:58
(Received via mailing list)
This code works 99% of the time, but sometimes when the Chooser is
deep in a directory and I press "Alt+Up" repeatedly, it will crash my
application within dialog.run giving this error:

/home/dan/projects/redcar/bin/../plugins/core/lib/core/dialog.rb: line
191
   GLib-GObject-WARNING **:instance of invalid non-instantiatable type
`(null)'

(line 191 is the dialog.run line)

Is likely to be a Ruby-GNOME2 issue? I have not experienced this in
any other GTK applications.

Code:

    def self.open(win, last_dir_opened=nil)
      dialog = Gtk::FileChooserDialog.new("Open",
                                          win,
                                          Gtk::FileChooser::ACTION_OPEN,
                                          nil,
                                          [Gtk::Stock::CANCEL,
Gtk::Dialog::RESPONSE_CANCEL],
                                          [Gtk::Stock::OPEN,
Gtk::Dialog::RESPONSE_ACCEPT])
      if last_dir_opened
        dialog.current_folder = last_dir_opened
      end
      filename = nil
      if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
        filename = dialog.filename
      end
      dialog.destroy
      filename
    end

# --- end

thank,
Dan
____________________________________

Daniel Benjamin Lucraft

www.daniellucraft.com/blog
twitter.com/danlucraft
This topic is locked and can not be replied to.