Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MSan] Use WeakPtr for done callback in DesktopMediaPickerViews tests
The test fixture uses base::Unretained() for the done callback, but DesktopMediaPickerViews::NotifyDialogResult() asynchronously invokes this callback when the picker is done. The test fixture also embeds a BrowserTaskEnvironment, which runs tasks until idle at destruction time. This ensures the callback runs before the test fixture is completely destroyed. Despite this, the current tests trigger MSan use-after-dtor errors, since the bound callback uses other fields of the test fixture which are already destroyed: fields are destroyed in reverse order of declaration, and BrowserTaskEnvironment is the first field. As it's unlikely that the test cares about the callback anymore when the fixture is destroyed, just use a WeakPtr. Bug: 40222690 Change-Id: If7c05f4e8bae01d4f5950776643b0273eab6a8ac Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5626676 Reviewed-by: Elly FJ <ellyjones@chromium.org> Commit-Queue: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/main@{#1314136}
- Loading branch information