GNOME Bugzilla – Bug 755215
Crash when renaming a sidebar’s folder (function that shouldn’t be there)
Last modified: 2015-09-25 14:11:31 UTC
Created attachment 311630 [details] Screenshot. The FileChooser dialog doesn’t usually (and shouldn’t) permit to rename folders or files, as it’s a selection dialog. But, when right-clicking in the GtkPlacesSidebar (on “Documents”/“Images”/“Music”…, hopefully not “Home Folder” nor “Trash”), you are able to rename some of the main folders, and that makes here the application crash (even if the renaming happens); this function should not be accessible here.
have a stacktrace ?
we allow renaming on bookmarks and xdg folders. but it only seems to be implemented for bookmarks. nothing should happen for xdg folders
"nothing should happen for xdg folders" What I meant to say here is: the code looks like nothing will happen, so I'm surprised by the crash. We should either implement the renaming for xdg-folders (at least nautilus might want that), or make the rename item sensitive only for bookmarks.
Created attachment 312060 [details] [review] gtkplacessidebar: avoid to use a freed string The string we were using is the representation of the internal text in the popover entry. However that can be freed before setting the bookmark label, if i.e. the row is destroyed and therefore the popover as well. To avoid that, duplicate the label in a local variable. One of the consequences is that for those people using development version we migth screwed its bookmarks file, since the bookmark manager wrote garbage from the already freed label.
Created attachment 312061 [details] [review] gtkbookmarksmanager: don't allow non valid utf8 in bookmarks In case some client send to us a non valid utf8 string, don't screw up the bookmarks file and just return.
Review of attachment 312060 [details] [review]: ok
Review of attachment 312061 [details] [review]: hmm, we don't usually do utf8 validation on parameters, with the understanding that its the callers responsibility to ensure that they pass valid strings. And we do validate the bookmarks already when we are loading the file
Created attachment 312132 [details] [review] gtkbookmarksmanager: don't allow non valid utf8 in bookmarks In case some client send to us a non valid utf8 string, don't screw up the bookmarks file and just return.
Review of attachment 312132 [details] [review]: ok
Thanks for review Mathias Attachment 312060 [details] pushed as ecc698a - gtkplacessidebar: avoid to use a freed string Attachment 312132 [details] pushed as 6e83c3b - gtkbookmarksmanager: don't allow non valid utf8 in bookmarks