GNOME Bugzilla – Bug 350988
crash with File Open in non-exisiting directory
Last modified: 2007-09-13 09:51:08 UTC
1) set the GConf key "/apps/epiphany/directories/open" to "/does/not/exist" 2) open epiphany 3) select File/Open 4) click "ok" to discard the warning that the given path does not exist 5) enter something (I used "/usr") into the location entry and press return. 6) *boom*
+ Trace 70272
This is with Debian sid's Epiphany 2.14 and Gtk CVS. I assume it's a Gtk bug but I'm not sure.
Bug in gtkfilechooserdialog or gtkfilechooserbutton; re-assigning.
Ok, I'm in way over my head here ;) The issue appears to be that the pending selection from gtk_file_chooser_set_filename is applied after the failed directory change. A second issue appears to be that the gtk_file_system_model->flags==GTK_TREE_MODEL_PERSIST is a lie. Excuse the slight futz... Index: gtkfilechooserdefault.c =================================================================== RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v retrieving revision 1.328 diff -u -p -r1.328 gtkfilechooserdefault.c --- gtkfilechooserdefault.c 18 Jul 2006 16:36:16 -0000 1.328 +++ gtkfilechooserdefault.c 13 Aug 2006 17:00:28 -0000 @@ -6254,6 +6250,8 @@ gtk_file_chooser_default_update_current_ if (impl->update_current_folder_handle) gtk_file_system_cancel_operation (impl->update_current_folder_handle); + pending_select_paths_free (impl); + /* Test validity of path here. */ data = g_new0 (struct UpdateCurrentFolderData, 1); data->impl = impl; @@ -6333,6 +6331,7 @@ gtk_file_chooser_default_select_path (Gt GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); GtkFilePath *parent_path; gboolean same_path; /* Test validity of path here. */ data = g_new0 (struct UpdateCurrentFolderData, 1); data->impl = impl; @@ -6333,6 +6331,7 @@ gtk_file_chooser_default_select_path (Gt GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); GtkFilePath *parent_path; gboolean same_path; + gboolean result; if (!gtk_file_system_get_parent (impl->file_system, path, &parent_path, error)) return FALSE; @@ -6349,32 +6348,25 @@ gtk_file_chooser_default_select_path (Gt same_path = gtk_file_path_compare (parent_path, impl->current_folder) == 0; } + result = TRUE; if (same_path && impl->load_state == LOAD_FINISHED) { - gboolean result; GSList paths; paths.data = (gpointer) path; paths.next = NULL; result = show_and_select_paths (impl, parent_path, &paths, error); - gtk_file_path_free (parent_path); - return result; } - - pending_select_paths_add (impl, path); - - if (!same_path) + else { - gboolean result; - - result = _gtk_file_chooser_set_current_folder_path (chooser, parent_path, error); - gtk_file_path_free (parent_path); - return result; + if (!same_path) + result = _gtk_file_chooser_set_current_folder_path (chooser, parent_path, error); + pending_select_paths_add (impl, path); } gtk_file_path_free (parent_path); - return TRUE; + return result; } static void Index: gtkfilesystemmodel.c =================================================================== RCS file: /cvs/gnome/gtk+/gtk/gtkfilesystemmodel.c,v retrieving revision 1.45 diff -u -p -r1.45 gtkfilesystemmodel.c --- gtkfilesystemmodel.c 14 May 2006 04:25:29 -0000 1.45 +++ gtkfilesystemmodel.c 13 Aug 2006 17:07:32 -0000 @@ -258,7 +258,7 @@ static GtkTreeModelFlags gtk_file_system_model_get_flags (GtkTreeModel *tree_model) { GtkFileSystemModel *model = GTK_FILE_SYSTEM_MODEL (tree_model); - GtkTreeModelFlags flags = GTK_TREE_MODEL_ITERS_PERSIST; + GtkTreeModelFlags flags = 0; //GTK_TREE_MODEL_ITERS_PERSIST; if (model->max_depth == 0) flags |= GTK_TREE_MODEL_LIST_ONLY;
Created attachment 70828 [details] Test case Note this does not entirely replicate the described problem but it does trigger assertions and a segfault.
*** Bug 351666 has been marked as a duplicate of this bug. ***
Thanks for the patch! I'll CC Kris, since he is working on this. Kris, can you please test Chris's patch? Chris, why do you say that ITERS_PERSIST is a lie? The file chooser model goes through quite a bit of pain to ensure that its iters persist. Where is this violated?
I observed instances where gtk_file_chooser_set_filename("/proc/self/exe") caused the GtkFileChooserButton to select a random file in the /proc/self directory. I attributed this to the search model caching iters across folder changes and clearing ITERS_PERSIST fixed the misbehaviour. However, I am unable to reproduce such behaviour now, so it was most likely a local side-effect when playing with the code. Instead, I have another oddity: the GtkFileChooserButton does not update its label unless the warning dialog for missing file in the other button. ie FileChooserButton("/proc/self/exe"): no label 2xFileChooserButton("/proc/self/exe"): no label FileChooserButton("/proc/self/exe")+FileChooserButton("/no/such/file"): label This is most definitely a side-effect of the above patch.
*** Bug 355997 has been marked as a duplicate of this bug. ***
Ubuntu bug about that: https://launchpad.net/distros/ubuntu/+source/inkscape/+bug/59058
I belive this was fixed by 2006-09-04 Kristian Rietveld <kris@imendio.com> Merged from HEAD: * gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb): if setting the given folder failed, try setting the parent folder until we succeed; display an error box at the end. At least the testcase in comment #3 does not crash for me.
*** Bug 361323 has been marked as a duplicate of this bug. ***
*** Bug 363630 has been marked as a duplicate of this bug. ***
*** Bug 364512 has been marked as a duplicate of this bug. ***
*** Bug 367015 has been marked as a duplicate of this bug. ***
*** Bug 367369 has been marked as a duplicate of this bug. ***
last duplicate is gtk+ 2.10.6 that should contain the fix, as comment #9 implies. Matthias?
*** Bug 367817 has been marked as a duplicate of this bug. ***
*** Bug 368773 has been marked as a duplicate of this bug. ***
*** Bug 368859 has been marked as a duplicate of this bug. ***
*** Bug 368888 has been marked as a duplicate of this bug. ***
It seems 2.10.6 still have this crash (at least according to simple-dup-finder).
*** Bug 369429 has been marked as a duplicate of this bug. ***
*** Bug 370218 has been marked as a duplicate of this bug. ***
*** Bug 371717 has been marked as a duplicate of this bug. ***
*** Bug 371964 has been marked as a duplicate of this bug. ***
*** Bug 372255 has been marked as a duplicate of this bug. ***
*** Bug 375311 has been marked as a duplicate of this bug. ***
*** Bug 378654 has been marked as a duplicate of this bug. ***
perhaps we were tricked by our simple-dup-finder script. the original trace asserts in gtk_file_chooser_default_should_respond() while many duplicates (at least the last two and mine) assert in gtk_file_chooser_default_new() However e.g. Frederico duped them to this one as well Reopening Matthias? Frederico?
*** Bug 378752 has been marked as a duplicate of this bug. ***
*** Bug 379355 has been marked as a duplicate of this bug. ***
*** Bug 380013 has been marked as a duplicate of this bug. ***
*** Bug 380001 has been marked as a duplicate of this bug. ***
*** Bug 378181 has been marked as a duplicate of this bug. ***
*** Bug 376279 has been marked as a duplicate of this bug. ***
*** Bug 379984 has been marked as a duplicate of this bug. ***
*** Bug 380172 has been marked as a duplicate of this bug. ***
*** Bug 379890 has been marked as a duplicate of this bug. ***
*** Bug 376329 has been marked as a duplicate of this bug. ***
*** Bug 377868 has been marked as a duplicate of this bug. ***
*** Bug 379772 has been marked as a duplicate of this bug. ***
*** Bug 380560 has been marked as a duplicate of this bug. ***
*** Bug 380652 has been marked as a duplicate of this bug. ***
*** Bug 385582 has been marked as a duplicate of this bug. ***
*** Bug 385606 has been marked as a duplicate of this bug. ***
*** Bug 385463 has been marked as a duplicate of this bug. ***
*** Bug 385066 has been marked as a duplicate of this bug. ***
*** Bug 385997 has been marked as a duplicate of this bug. ***
(In reply to comment #28) > perhaps we were tricked by our simple-dup-finder script. the original trace > asserts in gtk_file_chooser_default_should_respond() while many duplicates (at > least the last two and mine) assert in gtk_file_chooser_default_new() > > However e.g. Frederico duped them to this one as well > Reopening > > Matthias? Frederico? Hrm, I have the feeling too that the newer duplicates are indeed another bug and not related to the opening comment. The stack traces look a bit weird to me as well, so it is a little difficult to say where exactly the problem is ... (Haven't seen a good testcase yet either).
*** Bug 386071 has been marked as a duplicate of this bug. ***
*** Bug 386751 has been marked as a duplicate of this bug. ***
*** Bug 387263 has been marked as a duplicate of this bug. ***
*** Bug 388036 has been marked as a duplicate of this bug. ***
*** Bug 388643 has been marked as a duplicate of this bug. ***
*** Bug 387259 has been marked as a duplicate of this bug. ***
*** Bug 388677 has been marked as a duplicate of this bug. ***
*** Bug 390719 has been marked as a duplicate of this bug. ***
*** Bug 390721 has been marked as a duplicate of this bug. ***
I can reproduce this crash or a very similar one in the following way: - Open a very very big C file (80 Mb in my case) using gedit - Wait that gedit starts showing the file in the text view - Open the file browser (due to a already known problem, nothing is shown there) - Write something in the location entry - Press ok Gtk-ERROR **: file gtkfilechooserdefault.c: line 7772 (gtk_file_chooser_default_should_respond): assertion failed: (path != NULL)
*** Bug 392923 has been marked as a duplicate of this bug. ***
(FYI The nothing is shown bug is #348289.)
*** Bug 393399 has been marked as a duplicate of this bug. ***
*** Bug 393609 has been marked as a duplicate of this bug. ***
*** Bug 394656 has been marked as a duplicate of this bug. ***
*** Bug 394580 has been marked as a duplicate of this bug. ***
*** Bug 394952 has been marked as a duplicate of this bug. ***
*** Bug 394374 has been marked as a duplicate of this bug. ***
*** Bug 395517 has been marked as a duplicate of this bug. ***
*** Bug 396615 has been marked as a duplicate of this bug. ***
*** Bug 396644 has been marked as a duplicate of this bug. ***
*** Bug 397233 has been marked as a duplicate of this bug. ***
*** Bug 397245 has been marked as a duplicate of this bug. ***
Remove bugbuddy at green-lines dot com from cc: list.
*** Bug 397271 has been marked as a duplicate of this bug. ***
*** Bug 398341 has been marked as a duplicate of this bug. ***
*** Bug 399235 has been marked as a duplicate of this bug. ***
*** Bug 399409 has been marked as a duplicate of this bug. ***
*** Bug 399410 has been marked as a duplicate of this bug. ***
Being used to Thunderbird, I attempt to save emails and assume incorrectly that Evolution will remember the last place I saved one. I forget that I have to re-navigate to the place where I am saving email files. Sorry . . . Herk
*** Bug 399987 has been marked as a duplicate of this bug. ***
I can get a similar crash with Firefox. You can save something and then press <enter> while the save-dialog is still "loading", e.g. right-click on an image and then press "v" immediately followed by <enter>. This causes _gtk_file_chooser_entry_get_current_folder() and _gtk_file_chooser_entry_get_file_part() to be called from check_save_entry() in gtkfilechooserdefault.c before _gtk_file_chooser_entry_set_base_folder() has been called. check_save_entry() gets empty current_folder and file_part. It sees the empty file_part and sets *path_ret to current_folder (which is empty as well). There should probably at least be a check for an empty path like it's the case if file_part is not empty. Maybe something like this: --- gtk/gtkfilechooserdefault.c (revision 17121) +++ gtk/gtkfilechooserdefault.c (working copy) @@ -6634,7 +6634,19 @@ if (!file_part || file_part[0] == '\0') { - *path_ret = gtk_file_path_copy (current_folder); + path = gtk_file_path_copy (current_folder); + + if (!path) + { + *path_ret = NULL; + *is_well_formed_ret = FALSE; + *is_file_part_empty_ret = TRUE; + *is_folder = TRUE; /* or FALSE? */ + + return; + } + + *path_ret = path; *is_well_formed_ret = TRUE; *is_file_part_empty_ret = TRUE; *is_folder = TRUE;
*** Bug 377604 has been marked as a duplicate of this bug. ***
*** Bug 403993 has been marked as a duplicate of this bug. ***
*** Bug 408124 has been marked as a duplicate of this bug. ***
*** Bug 409804 has been marked as a duplicate of this bug. ***
*** Bug 412858 has been marked as a duplicate of this bug. ***
*** Bug 413712 has been marked as a duplicate of this bug. ***
It seems to me that the current_folder == NULL check should be outside of the "empty filepart" check, since current_folder being NULL will also trip gtk_file_system_make_path further down. Kris, does this make sense ?
*** Bug 416803 has been marked as a duplicate of this bug. ***
(In reply to comment #87) > It seems to me that the current_folder == NULL check should be outside of the > "empty filepart" check, since current_folder being NULL will also trip > gtk_file_system_make_path further down. > > Kris, does this make sense ? Yes, I think so. I just tested this patch, which bails out immediately when current_folder appears to be NULL, with the testcase Paolo mentioned in comment 58: Index: gtkfilechooserdefault.c =================================================================== --- gtkfilechooserdefault.c (revision 17455) +++ gtkfilechooserdefault.c (working copy) @@ -6630,6 +6630,16 @@ check_save_entry (GtkFileChooserDefault *is_empty_ret = FALSE; current_folder = _gtk_file_chooser_entry_get_current_folder (chooser_entry); + if (!current_folder) + { + *path_ret = NULL; + *is_well_formed_ret = FALSE; + *is_file_part_empty_ret = FALSE; + *is_folder = FALSE; + + return; + } + file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry); if (!file_part || file_part[0] == '\0') And it seems to work well. Instead of crashing, pressing the Ok button will have no effect. All tests of autotestfilechooser also still pass. Matthias, if you agree maybe we should put this into 2.10.10?
133 dups so far - matthias, can this please get into 2.10.10?
Sure, since Kris agrees, we should get this patch into 2.10.10. Kris can you commit this today ? I'll have to get 2.10.10 out somehow tomorrow...
Committed on trunk and gtk-2-10.
*** Bug 417796 has been marked as a duplicate of this bug. ***
*** Bug 420016 has been marked as a duplicate of this bug. ***
*** Bug 423318 has been marked as a duplicate of this bug. ***
Closing as per comment 92. Fixed in version 2.10.10. Patch: http://svn.gnome.org/viewcvs/gtk%2B/branches/gtk-2-10/gtk/gtkfilechooserdefault.c?r1=17477&r2=17480
*** Bug 425954 has been marked as a duplicate of this bug. ***
*** Bug 426820 has been marked as a duplicate of this bug. ***
*** Bug 427142 has been marked as a duplicate of this bug. ***
*** Bug 428364 has been marked as a duplicate of this bug. ***
SuSE bug: https://bugzilla.novell.com/show_bug.cgi?id=263774
I don't have any records of this, or a whold series of similar bug reports being sent to you. I have not experienced any bugs for about a month.
*** Bug 429381 has been marked as a duplicate of this bug. ***
*** Bug 430622 has been marked as a duplicate of this bug. ***
*** Bug 430778 has been marked as a duplicate of this bug. ***
New Ubuntu stable is available now and has GTK 2.10.11
*** Bug 432053 has been marked as a duplicate of this bug. ***
*** Bug 432693 has been marked as a duplicate of this bug. ***
*** Bug 433194 has been marked as a duplicate of this bug. ***
*** Bug 433197 has been marked as a duplicate of this bug. ***
*** Bug 433206 has been marked as a duplicate of this bug. ***
*** Bug 433207 has been marked as a duplicate of this bug. ***
*** Bug 433228 has been marked as a duplicate of this bug. ***
*** Bug 433257 has been marked as a duplicate of this bug. ***
*** Bug 412406 has been marked as a duplicate of this bug. ***
*** Bug 423719 has been marked as a duplicate of this bug. ***
*** Bug 430895 has been marked as a duplicate of this bug. ***
*** Bug 430998 has been marked as a duplicate of this bug. ***
*** Bug 434002 has been marked as a duplicate of this bug. ***
*** Bug 434746 has been marked as a duplicate of this bug. ***
*** Bug 434757 has been marked as a duplicate of this bug. ***
*** Bug 434768 has been marked as a duplicate of this bug. ***
*** Bug 434803 has been marked as a duplicate of this bug. ***
*** Bug 434819 has been marked as a duplicate of this bug. ***
*** Bug 424081 has been marked as a duplicate of this bug. ***
*** Bug 425851 has been marked as a duplicate of this bug. ***
*** Bug 429916 has been marked as a duplicate of this bug. ***
*** Bug 435691 has been marked as a duplicate of this bug. ***
*** Bug 436256 has been marked as a duplicate of this bug. ***
*** Bug 436264 has been marked as a duplicate of this bug. ***
*** Bug 436266 has been marked as a duplicate of this bug. ***
*** Bug 436295 has been marked as a duplicate of this bug. ***
*** Bug 436302 has been marked as a duplicate of this bug. ***
*** Bug 436344 has been marked as a duplicate of this bug. ***
*** Bug 436009 has been marked as a duplicate of this bug. ***
*** Bug 439690 has been marked as a duplicate of this bug. ***
*** Bug 440096 has been marked as a duplicate of this bug. ***
*** Bug 442820 has been marked as a duplicate of this bug. ***
*** Bug 444296 has been marked as a duplicate of this bug. ***
*** Bug 444339 has been marked as a duplicate of this bug. ***
*** Bug 444344 has been marked as a duplicate of this bug. ***
*** Bug 449161 has been marked as a duplicate of this bug. ***
*** Bug 451134 has been marked as a duplicate of this bug. ***
*** Bug 451876 has been marked as a duplicate of this bug. ***
*** Bug 452167 has been marked as a duplicate of this bug. ***
*** Bug 452504 has been marked as a duplicate of this bug. ***
*** Bug 452778 has been marked as a duplicate of this bug. ***
*** Bug 452777 has been marked as a duplicate of this bug. ***
*** Bug 408955 has been marked as a duplicate of this bug. ***
*** Bug 453293 has been marked as a duplicate of this bug. ***
*** Bug 455318 has been marked as a duplicate of this bug. ***
*** Bug 460492 has been marked as a duplicate of this bug. ***
*** Bug 463922 has been marked as a duplicate of this bug. ***
*** Bug 465269 has been marked as a duplicate of this bug. ***
*** Bug 469672 has been marked as a duplicate of this bug. ***
*** Bug 476210 has been marked as a duplicate of this bug. ***
*** Bug 476469 has been marked as a duplicate of this bug. ***
*** Bug 459795 has been marked as a duplicate of this bug. ***
*** Bug 412311 has been marked as a duplicate of this bug. ***
*** Bug 408675 has been marked as a duplicate of this bug. ***