# Crash in GtkFileChooser

**URL:** <https://www.ruby-forum.com/t/crash-in-gtkfilechooser/166360>\
**Category:** Ruby-Gnome 2\
**Created:** [April 24, 2009, 9:58am UTC](https://www.ruby-forum.com/t/crash-in-gtkfilechooser/166360 "2009-04-24T09:58:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![liberte](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@liberte](https://www.ruby-forum.com/u/liberte)\
**Post date:** [April 24, 2009, 9:58am UTC](https://www.ruby-forum.com/t/crash-in-gtkfilechooser/166360/1 "2009-04-24T09:58:58Z")

</div>

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](http://www.daniellucraft.com/blog)  
[twitter.com/danlucraft](http://twitter.com/danlucraft)
