nautilus-bookmark: don't crash if file is gone

Sometimes the file can be gone without even noticing when
changing the location (and therefore creating the attached bookmark
to that new location).
In bookmark_changed we just disconnected the file if that happened,
so we where failing graciously. But that was not the case when just
changing the location, where we were asserting that the file is not gone
and therefore crashing in such case.

Instead of that, do something similar as bookmark_changed and just
clean up some of the bookmark objects and hope for the best.
parent 3ba1c367
......@@ -346,7 +346,14 @@ nautilus_bookmark_connect_file (NautilusBookmark *bookmark)
DEBUG ("%s: creating file", nautilus_bookmark_get_name (bookmark));
bookmark->details->file = nautilus_file_get (bookmark->details->location);
g_assert (!nautilus_file_is_gone (bookmark->details->file));
/* Similar to what we do when a file has been trashed or deleted
* withouth noticing in bookmark_changed, just try to fall graciously.
*/
if (nautilus_file_is_gone (bookmark->details->file))
{
nautilus_bookmark_disconnect_file (bookmark);
return;
}
g_signal_connect_object (bookmark->details->file, "changed",
G_CALLBACK (bookmark_file_changed_callback), bookmark, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment