GNOME Bugzilla – Bug 761757
Crash in GtkFileChooserWidget
Last modified: 2016-02-14 06:09:26 UTC
I've been able to reliably reproduce a crash in git master and 3.18 GtkFileChooserWidget with this small patch added to testfilechooser.c: diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c index 6d31224..95d9b98 100644 --- a/tests/testfilechooser.c +++ b/tests/testfilechooser.c @@ -601,6 +601,7 @@ main (int argc, char **argv) _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_OK, NULL); + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), "Untitled"); break; } gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); Steps to reproduce: - mkdir ~/test - touch ~/test/foo - start testfilechooser -a save - navigate to ~/test - click on 'foo' in the file list - type 'foo' to trigger the search bar - click in the toplevel 'name' text entry - type 'bar' -> the save button becomes grayed out - click on 'foo' in the file list - press the save button -> crash Backtrace for the crash:
+ Trace 235956
This crash has been reported several times in fedora https://bugzilla.redhat.com/show_bug.cgi?id=1297632
Actually there are 2 distinct bugs. The crash reproducer can be simplified as: - mkdir ~/test - touch ~/test/foo - start testfilechooser -a save - navigate to ~/test - click on 'foo' in the file list - type 'foo' to trigger the search bar [unnecessary steps removed] - press the save button -> crash Other bug is that the save button unexpectedly inactive: - mkdir ~/test - touch ~/test/foo - start testfilechooser -a save - navigate to ~/test - click on 'foo' in the file list - type 'foo' to trigger the search bar - click in the toplevel 'name' text entry - type 'bar' -> the save button becomes grayed out The save button is grayed out by file_chooser_widget_selection_changed() because gtk_file_chooser_get_uris() returns NULL when the search bar is shown. I guess the search bar should be cleared as soon as one starts typing in the "Name" text entry.
thanks for the detailed analysis
Created attachment 321055 [details] Missing folder view after search Regarding the fix for the inactive save button; the search entry box now disappears and the "Save" button becomes active again, but the directory browsing view (file list) is not restored. (See attached screen shots.)
Created attachment 321095 [details] [review] Tentative fix for missing folder view after search The attached diff makes it behave correctly; I'm not submitting it as a proper patch because I'm not sure it's correct and some refactoring seems to be needed (the same if/else block appears 3 more times in the same file).