Crash in GtkFileChooser


#1

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