Fix "eject when unmounting".
It seems getting the device from the partition after it is unmounted does not work reliably. Get the device much earlier in the function, before actually unmounting it. Fixes #2630.
This commit is contained in:
parent
487d015ab7
commit
d3a46694d5
@ -616,11 +616,15 @@ void
|
||||
AutoMounter::_UnmountAndEjectVolume(BPartition* partition, BPath& mountPoint,
|
||||
const char* name)
|
||||
{
|
||||
BDiskDevice device;
|
||||
BDiskDevice deviceStorage;
|
||||
BDiskDevice* device;
|
||||
if (partition == NULL) {
|
||||
// Try to retrieve partition
|
||||
BDiskDeviceRoster().FindPartitionByMountPoint(mountPoint.Path(),
|
||||
&device, &partition);
|
||||
&deviceStorage, &partition);
|
||||
device = &deviceStorage;
|
||||
} else {
|
||||
device = partition->Device();
|
||||
}
|
||||
|
||||
status_t status;
|
||||
@ -678,10 +682,10 @@ AutoMounter::_UnmountAndEjectVolume(BPartition* partition, BPath& mountPoint,
|
||||
bool fHasMounted;
|
||||
} visitor;
|
||||
|
||||
partition->Device()->VisitEachDescendant(&visitor);
|
||||
device->VisitEachDescendant(&visitor);
|
||||
|
||||
if (!visitor.HasMountedPartitions())
|
||||
partition->Device()->Eject();
|
||||
device->Eject();
|
||||
}
|
||||
|
||||
// remove the directory if it's a directory in rootfs
|
||||
|
@ -3,8 +3,8 @@ SubDir HAIKU_TOP src servers mount ;
|
||||
UsePrivateHeaders mount shared storage ;
|
||||
|
||||
Server mount_server
|
||||
:
|
||||
AutoMounter.cpp
|
||||
:
|
||||
AutoMounter.cpp
|
||||
# AutoMounterSettings.cpp
|
||||
:
|
||||
libbe.so localestub
|
||||
|
Loading…
Reference in New Issue
Block a user