After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 497770 - gtk_file_chooser_set_filename fails to set the filename randomly
gtk_file_chooser_set_filename fails to set the filename randomly
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.12.x
Other All
: Normal critical
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2007-11-17 22:52 UTC by raster
Modified: 2008-02-06 17:25 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
c source, glade-xml file and Makefile to test the bug (1.15 KB, application/x-compressed-tar)
2007-11-17 23:21 UTC, raster
Details

Description raster 2007-11-17 22:52:51 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:


Actual results:
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.

Expected results:
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.

Other information:
I'll try to upload a C sample code.
Comment 1 raster 2007-11-17 23:21:28 UTC
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.
Comment 2 raster 2007-11-17 23:49:23 UTC
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.
Comment 3 raster 2007-11-18 12:43:22 UTC
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.
Comment 4 Marcos Pinto 2007-12-10 04:04:11 UTC
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?  
Comment 5 Federico Mena Quintero 2008-02-06 17:25:58 UTC
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?