While tracking down a segfault problem in exaile we found that this little python script already segfaults when clicking on the button and works if the SessionBus line is commented out. <- CODE -> #!/usr/bin/python import pygtk, dbus pygtk.require("2.0") import gtk session_bus = dbus.SessionBus() frame = gtk.Window() button = gtk.Button("click me") frame.add(button) def somefunction(widget): dialog = gtk.FileChooserDialog("Choose a file", frame, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=('Open', gtk.RESPONSE_OK, 'Cancel', gtk.RESPONSE_CANCEL)) print dialog.run() dialog.destroy() button.connect('clicked', somefunction) frame.resize(100, 20) frame.show_all() gtk.main() <- CODE -> These are the versions I am using: dev-lang/python-2.4.3-r4 sys-apps/dbus-0.62-r1 dev-python/pygtk-2.10.1 x11-libs/gtk+-2.10.6 If any additional information are needed just drop me a short line
Adding this solves the problem: import pygtk, dbus, gobject, dbus.glib gobject.threads_init() dbus.glib.threads_init()
I believe a newer D-Bus will be less problematic when you don't init threads first. See http://www.j5live.com/?p=246 and http://www.j5live.com/?p=252