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 379414 - file chooser warnings when changing path in the entry
file chooser warnings when changing path in the entry
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.10.x
Other Linux
: Urgent critical
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
: 341890 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-11-26 10:51 UTC by Carlos Garnacho
Modified: 2011-02-04 16:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (7.36 KB, patch)
2006-11-26 10:53 UTC, Carlos Garnacho
accepted-commit_now Details | Review

Description Carlos Garnacho 2006-11-26 10:51:58 UTC
Hi!,

if I change the path in the filechooser entry in testfilechooser, I pretty consistently get this warning:

(lt-testfilechooser:29400): Gtk-WARNING **: idle activate multiple times without clearing the folder object first.

I've been tracing the error, and here are the steps that cause this error

1) run testfilechooser in ~/foo/bar/gtk+/tests/
2) type another path (say /usr/share/) and press enter
3) gtk_file_chooser_entry_maybe_update_directory is called (twice) as the result of the "changed" signal being emitted in the entry (when clearing its contents, it's worth noting that the directory it's trying to load here is ~/foo/bar/gtk+/tests, not /usr/share/, because the current folder hasn't still changed)
4) load_directory_callback is called once, the idle is only added the first time in step 3.
5) gtk_file_chooser_entry_maybe_update_directory is called again, this time as a result of calling _gtk_file_chooser_entry_set_base_folder when changing the base directory to /usr/share/.
6) load_directory_get_folder_callback is called when the *old* folder is loaded, this handler is a result of step 4.
7) load_directory_callback is called once again (as a result of step 5), but current_folder is already not NULL and fails.
8) despite being in /usr/share/, the entry completion shows matches from ~/foo/bar/gtk+/tests/

I'm attaching a patch to fix it in GtkFileChooserDefault, it clears the entry after setting its base folder if it's told so (avoiding reloading the old directory) , and makes the code use that wherever necessary.
Comment 1 Carlos Garnacho 2006-11-26 10:53:42 UTC
Created attachment 77160 [details] [review]
patch
Comment 2 Federico Mena Quintero 2007-01-25 20:19:08 UTC
*** Bug 341890 has been marked as a duplicate of this bug. ***
Comment 3 Federico Mena Quintero 2007-01-25 20:20:45 UTC
Thanks for the patch!  I'll test and review it soon.  Can you please provide a ChangeLog?
Comment 4 Carlos Garnacho 2007-02-05 01:42:37 UTC
Doh! didn't realize of your answer :), Here's the ChangeLog:

* gtk/gtkfilechooserdefault.c (struct UpdateCurrentFolderData), (update_current_folder_get_info_cb): add a new struct field to clear the file entry after the current folder has been updated.

(gtk_file_chooser_default_update_current_folder), (change_folder_and_display_error): Add a new function parameter to trigger file entry clearing.

(edited_idle_create_folder_cb), (file_list_drag_data_received_get_info_cb), (gtk_file_chooser_default_map), (gtk_file_chooser_default_set_current_folder), (switch_to_selected_folder), (save_entry_get_info_cb), (shortcuts_activate_volume_mount_cb), (shortcuts_activate_volume), (shortcuts_activate_get_info_cb), (list_row_activated), (path_bar_clicked): use new function parameter appropriately.

(gtk_file_chooser_default_should_respond): trigger file entry clearing after the directory is updated instead of clearing it before, this way we avoid reloading the completion model with the soon to be old folder, causing a warning and a glitch in the folder where completion happens. Bug #379414.
Comment 5 Kjartan Maraas 2007-02-09 16:32:05 UTC
Federico, please take a look at this again :-)
Comment 6 André Klapper 2007-02-17 01:45:29 UTC
are bug 390314, bug 408675 and bug 350988 duplicates?
Comment 7 Matthias Clasen 2007-03-08 03:14:57 UTC
Federico, any update ?
Comment 8 Federico Mena Quintero 2007-04-30 18:58:28 UTC
Comment on attachment 77160 [details] [review]
patch

Nice work!  Please go ahead and commit with that ChangeLog.
Comment 9 Matthias Clasen 2007-05-01 22:02:14 UTC
2007-05-01  Matthias Clasen  <mclasen@redhat.com>

	Merge from trunk:

        * gtk/gtkfilechooserdefault.c (struct UpdateCurrentFolderData),
        (update_current_folder_get_info_cb): add a new struct field to clear
        the file entry after the current folder has been updated.

        (gtk_file_chooser_default_update_current_folder),
        (change_folder_and_display_error): Add a new function parameter to
        trigger file entry clearing.

        (edited_idle_create_folder_cb),
        (file_list_drag_data_received_get_info_cb),
        (gtk_file_chooser_default_map),
        (gtk_file_chooser_default_set_current_folder),
        (switch_to_selected_folder), (save_entry_get_info_cb),
        (shortcuts_activate_volume_mount_cb), (shortcuts_activate_volume),
        (shortcuts_activate_get_info_cb), (list_row_activated),
        (path_bar_clicked): use new function parameter appropriately.

        (gtk_file_chooser_default_should_respond): trigger file entry clearing
        after the directory is updated instead of clearing it before, this way
        we avoid reloading the completion model with the soon to be old folder,
        causing a warning and a glitch in the folder where completion happens.
        (#379414, Carlos Garnacho)