GNOME Bugzilla – Bug 497770
gtk_file_chooser_set_filename fails to set the filename randomly
Last modified: 2008-02-06 17:25:58 UTC
Please describe the problem:
In my application I have a window where the user can choose a file (with a GtkFileChooserButton) and set some properties for the file. I use the same window both for a new file, and for changing the file properties. In this last case I create the window, use gtk_file_chooser_set_filename to set the file name, and show the window. But very often the filechooserbutton remains without file.
I'm using Ubuntu 7.10. With Ubuntu 7.04 it worked fine.
Steps to reproduce:
The SelectionChanged callback reports between 4 to 6 changes. Sometimes the change works (the first three sets the file name to None, and the last to the right file name), but sometimes it doesn't work (all callback calls report changing to None, or the two first to None, the third to the filename, and the fourth and fiveth to none). But the path is changed to the right one.
The filename and the path should be changed to the specified one.
Does this happen every time?
Is random. Sometimes it works fine, sometimes not, with exactly the same file name and path.
I'll try to upload a C sample code.
Created attachment 99261 [details]
c source, glade-xml file and Makefile to test the bug
To test the bug, compile the code and run it with a complete path as first parameter.
Example: ./test_fchooser /home/mydir/a_file_name.mpg
It will show a window with one GtkFileChooserButton, which should point to that filename (but fails to do it randomly), and in the console will print a line for each call to the SELECTION-CHANGED callback, printing the result of gtk_file_chooser_get_filename too.
I forgot to comment about the test program: run it several times with the same path to see how sometimes it works, and sometimes, not.
I made some new tests. I did a modification in the code that first shows the window with the GtkFileChooserButton, enters the main loop, and a second after (using a g_timeout_add timer), uses gtk_file_chooser_set_filename() to change the current file. It fails randomly too. The callback is called several times too.
I tried to do an unselect_all() first, wait another second, and select_filename(). The first call didn't triggered the SELECTION-CHANGED callback; the second, triggered it several times, like set_filename(), and failed again.
I can confirm this bug...however, it only seens to happen on Ubuntu. Works just fine on Gentoo and Win32. Any official word on this?
This may be fixed with the patch for bug #419737. Can you please wait for an updated package, and reopen the bug if the problem persists?