GNOME Bugzilla – Bug 148803
FileChooser test program gives Critical warnings
Last modified: 2011-02-04 16:16:49 UTC
1) it gives warnings when the 'open' toolbaritem is activated: uimanager.py.co:104: GtkWarning: file gtksettings.c: line 447 (gtk_settings_get_for_screen): assertion `GDK_IS_SCREEN (screen)' failed (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, (uimanager.py.co:1468): GLib-GObject-WARNING **: invalid (NULL) pointer instance (uimanager.py.co:1468): GLib-GObject-CRITICAL **: file gsignal.c: line 1726 (g_signal_handler_disconnect): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed (I don't think example code should give warnings. I mean, warnings is a sign that something is wrong, right?) 2) it contains an unpythonic iteration over a list: in fix_actions: for i in range(len(actions)): curr = actions[i] instead of simply: for curr in actions:
I can't reproduce 1) and it looks like the offending line is creating a FileChooserDialog. What version of gtk and pygtk are you using? Do you get the same error messages in a simple program just creating a FileChooserDialog? This isn't a documentation bug.
Indeed: >>> import gtk >>> gtk.FileChooserDialog() __main__:1: GtkWarning: file gtksettings.c: line 447 (gtk_settings_get_for_screen): assertion `GDK_IS_SCREEN (screen)' failed (:551): GLib-GObject-WARNING **: invalid (NULL) pointer instance (:551): GLib-GObject-CRITICAL **: file gsignal.c: line 1726 (g_signal_handler_disconnect): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed <gtk.FileChooserDialog object (GtkFileChooserDialog) at 0x4021ee3c> >>> gtk.gtk_version (2, 4, 4) >>> gtk.pygtk_version (2, 3, 94) >>> so the warnings come from creating the FileChooserDialog Is this enough information to reproduce it? (I actually filed it as a documentation bug because I wanted to file #2 first which _is_ a documentation bug (example code is part of the documentation, isn't it?) and only noticed #1 later.)
I am using GTK+ 2.4.0 and the problem does not occur. I installed 2.4.4 and the problem occurs so I would say that this is a GTK+ bug.
We need a short selfcontained testcase in C. The warnings by themself don't tell much. At the very least we need a stacktrace showing where in GTK the warning was produced. Run your application in gdb with --g-fatal-warnings, and when the warning occurs, type bt at the gdb prompt.
Running the gtk+-2.4.4/tests/testfilechooser in gdb: (gdb) bt
+ Trace 48993
Created attachment 30392 [details] [review] do not call remove_setting when screen is NULL At creating widget, previous_screen argument can be NULL.
Here is the fix that went in * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_style_set): Don't install the settings_notify_cb from here, since it may be called before the first screen_changed signal, confusing the logic in gtk_file_chooser_screen_changed(). (#148803, Abel Daniel)