GNOME Bugzilla – Bug 611569
Nautilus window quits on unmounting [when partition is launched from places menu]
Last modified: 2012-10-26 19:13:13 UTC
Steps to reproduce: 1: From Places > Select an unmounted partition [nautilus window opens with the /media/partition ] 2: Now "unmount" the partition either using the unmount button or from the context menu. Deviation: Nautilus window just quits as the partition unmounts Expected behavior: The window needs to be redirected to computer:// This seems to be a side-effect of a fix for https://bugzilla.gnome.org/show_bug.cgi?id=591458 Earlier , the partition would just redirect to /media irrespective of where the partition was launched from. Now , instead if the partition was mounted from the nautilus sidepane , the redirect to computer:// works as intended.[Also, if the partition is at some point selected in the sidepane this nautilus quitting does not happen]
Bug first reported in lp: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/530542
Created attachment 155099 [details] [review] Keep single mount window open when unmounting The problem appears to be that all slots showing "mount contents only" are listed for closure. If you opened the mount folder directly (e.g. through Places) then that slot will be in the "close list" because its browse history only contains mount folders in it. To remedy this, the patch adds a condition such that if the "close list" only contains one slot then that slot becomes the "force_no_close_slot". This means that there will always be at least one slot redirected to computer:///.
Created attachment 155531 [details] [review] Implement "initiated_unmount" property for NautilusWindow Windows will have "initiated_unmount" set to TRUE when one of their slots initiates an unmount.
Created attachment 155532 [details] [review] Set "initiated_unmount" before removing a mount
Created attachment 155533 [details] [review] Don't call mount_removed_callback on "mount_pre_unmount" signal. Previously, mount_removed_callback would be called on "mount_pre_unmount" and on "mount_removed". It should only be called once so that we can do property checks/resets once per mount.
Created attachment 155534 [details] [review] Check for the initiated_unmount window property. If a window has initiated_unmount, it's slots will never be closed. Also, if none of our windows have initiated_unmount, don't close anything.
Thats still not quite right. First of all we must handle pre_unmount as closing these windows may be important for allowing the unmount to succeed (since e.g. a watch could be holding the directory open). Secondly, its not safe to do the unsetting of initiated_unmount in the "detected an unmount" callback, since this is called for any kind of unmount (for example other unmounts going on in parallel) and its not always called (for instance if the unmount operation failed. Instead we much unset it in the callback from the unmount operation.
This seems wrong too: > Also, if none of our windows have initiated_unmount, don't close anything. At least its not an obviously right change in behaviour.
Setting fields according to Alexander's review.
the issue is still there in GNOME 3.2
I believe this works correctly in git master (and gnome-3-6) after these fixes [1] [2]. The patches also don't apply anymore, as the code changed considerably in the meantime. Closing as OBSOLETE, feel free to reopen in case I missed something. [1] http://git.gnome.org/browse/nautilus/commit/?id=6d0a7e059207000307acaf96ec2c44196266f115 [2] http://git.gnome.org/browse/nautilus/commit/?id=3891241ba760c59d284b7579dbd340651c8d4d29