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 761757 - Crash in GtkFileChooserWidget
Crash in GtkFileChooserWidget
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.19.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2016-02-09 11:31 UTC by Christophe Fergeau
Modified: 2016-02-14 06:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Missing folder view after search (60.61 KB, image/png)
2016-02-13 07:50 UTC, Evangelos Foutras
  Details
Tentative fix for missing folder view after search (1.28 KB, patch)
2016-02-14 06:09 UTC, Evangelos Foutras
none Details | Review

Description Christophe Fergeau 2016-02-09 11:31:38 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:

  • #0 __GI_raise
    at ../sysdeps/unix/sysv/linux/raise.c line 55
  • #1 __GI_abort
    at abort.c line 89
  • #2 g_assertion_message
  • #3 g_assertion_message_expr
    at gtestutils.c line 2452
  • #4 get_display_name_from_file_list
    at gtkfilechooserwidget.c line 6295
  • #5 gtk_file_chooser_widget_should_respond
    at gtkfilechooserwidget.c line 6843
  • #6 _gtk_file_chooser_embed_should_respond
    at gtkfilechooserembed.c line 185
  • #7 response_cb
    at gtkfilechooserdialog.c line 686
  • #8 g_cclosure_marshal_VOID__INT
    at gmarshal.c line 1162
  • #9 g_closure_invoke
    at gclosure.c line 804
  • #10 signal_emit_unlocked_R
    at gsignal.c line 3629
  • #11 g_signal_emit_valist
    at gsignal.c line 3385
  • #12 g_signal_emit
    at gsignal.c line 3441
  • #13 gtk_dialog_response
    at gtkdialog.c line 1235
  • #14 action_widget_activated
    at gtkdialog.c line 319
  • #15 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 905
  • #16 _g_closure_invoke_va
    at gclosure.c line 867
  • #17 g_signal_emit_valist
    at gsignal.c line 3294
  • #18 g_signal_emit
    at gsignal.c line 3441
  • #19 gtk_button_clicked
    at gtkbutton.c line 1538
  • #20 gtk_button_do_release
    at gtkbutton.c line 1842
  • #21 gtk_real_button_released
    at gtkbutton.c line 1960
  • #22 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 905
  • #23 g_type_class_meta_marshalv
    at gclosure.c line 1024
  • #24 _g_closure_invoke_va
    at gclosure.c line 867
  • #25 g_signal_emit_valist
    at gsignal.c line 3294
  • #26 g_signal_emit
    at gsignal.c line 3441
  • #27 multipress_released_cb
    at gtkbutton.c line 665
  • #28 ffi_call_unix64
    at ../src/x86/unix64.S line 76
  • #29 ffi_call
    at ../src/x86/ffi64.c line 525
  • #30 g_cclosure_marshal_generic_va
    at gclosure.c line 1604
  • #31 _g_closure_invoke_va
    at gclosure.c line 867
  • #32 g_signal_emit_valist
    at gsignal.c line 3294
  • #33 g_signal_emit
    at gsignal.c line 3441
  • #34 gtk_gesture_multi_press_end
    at gtkgesturemultipress.c line 273
  • #35 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1950
  • #36 g_type_class_meta_marshalv
    at gclosure.c line 1024
  • #37 _g_closure_invoke_va
    at gclosure.c line 867
  • #38 g_signal_emit_valist
    at gsignal.c line 3294
  • #39 g_signal_emit
    at gsignal.c line 3441
  • #40 _gtk_gesture_set_recognized
    at gtkgesture.c line 345
  • #41 _gtk_gesture_check_recognized
    at gtkgesture.c line 386
  • #42 gtk_gesture_handle_event
    at gtkgesture.c line 777
  • #43 gtk_gesture_single_handle_event
    at gtkgesturesingle.c line 221
  • #44 gtk_event_controller_handle_event
    at gtkeventcontroller.c line 230
  • #45 _gtk_widget_run_controllers
    at gtkwidget.c line 7331
  • #46 gtk_widget_real_button_event
    at gtkwidget.c line 7106
  • #47 _gtk_marshal_BOOLEAN__BOXEDv
    at gtkmarshalers.c line 130
  • #48 g_type_class_meta_marshalv
    at gclosure.c line 1024
  • #49 _g_closure_invoke_va
    at gclosure.c line 867
  • #50 g_signal_emit_valist
    at gsignal.c line 3294
  • #51 g_signal_emit
    at gsignal.c line 3441
  • #52 gtk_widget_event_internal
    at gtkwidget.c line 7706
  • #53 gtk_widget_event
    at gtkwidget.c line 7266
  • #54 propagate_event_up
    at gtkmain.c line 2522
  • #55 propagate_event
    at gtkmain.c line 2624
  • #56 gtk_propagate_event
    at gtkmain.c line 2659
  • #57 gtk_main_do_event
    at gtkmain.c line 1855
  • #58 _gdk_event_emit
    at gdkevents.c line 73
  • #59 gdk_event_source_dispatch
    at gdkeventsource.c line 364
  • #60 g_main_dispatch
    at gmain.c line 3154
  • #61 g_main_context_dispatch
    at gmain.c line 3769
  • #62 g_main_context_iterate
    at gmain.c line 3840
  • #63 g_main_loop_run
    at gmain.c line 4034
  • #64 gtk_main
    at gtkmain.c line 1246
  • #65 main
    at testfilechooser.c line 766

Comment 1 Christophe Fergeau 2016-02-09 11:32:13 UTC
This crash has been reported several times in fedora https://bugzilla.redhat.com/show_bug.cgi?id=1297632
Comment 2 Christophe Fergeau 2016-02-09 12:00:47 UTC
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.
Comment 3 Matthias Clasen 2016-02-09 12:47:14 UTC
thanks for the detailed analysis
Comment 4 Evangelos Foutras 2016-02-13 07:50:39 UTC
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.)
Comment 5 Evangelos Foutras 2016-02-14 06:09:26 UTC
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).