0

Reorder operations in DiskMountManagerImpl::OnUnmountPath()

Send the MountEvent::UNMOUNTING event after having removed the
MountPoint object in question from DiskMountManagerImpl::mount_points_.

BUG=b:362929648
TEST=chromeos_unittests --gtest_filter=DiskMountManagerTest.*

Change-Id: I16e61efa35e93e4cb12c86789b6b93c7dcb99731
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6090595
Reviewed-by: Nigel Tao <nigeltao@chromium.org>
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Auto-Submit: François Degros <fdegros@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395755}
This commit is contained in:
François Degros
2024-12-12 19:54:00 -08:00
committed by Chromium LUCI CQ
parent 784b683eaa
commit a9fbe4ceca

@ -632,21 +632,24 @@ class DiskMountManagerImpl : public DiskMountManager,
}
}
if (const MountPoints::const_iterator mount_point =
mount_points_.find(mount_path);
mount_point != mount_points_.end()) {
NotifyMountStatusUpdate(UNMOUNTING, error, *mount_point);
if (const MountPoints::const_iterator it = mount_points_.find(mount_path);
it != mount_points_.end()) {
if (error == MountError::kSuccess) {
const MountPoints::node_type n = mount_points_.extract(it);
DCHECK(n);
const MountPoint& mount_point = n.value();
if (const Disks::const_iterator disk =
disks_.find(mount_point->source_path);
disks_.find(mount_point.source_path);
disk != disks_.end()) {
DCHECK(*disk);
(*disk)->clear_mount_path();
(*disk)->set_mounted(false);
}
mount_points_.erase(mount_point);
NotifyMountStatusUpdate(UNMOUNTING, error, mount_point);
} else {
NotifyMountStatusUpdate(UNMOUNTING, error, *it);
}
}