There are a few instances where we make a variable 'auto protectedThis' and assign it directly to 'weakThis.get()', which seems wrong. In some cases I think it doesn't matter but in others, it could be problematic: SystemPreviewControllerCocoa.mm:403 WeakPtr weakThis { *this }; bool shouldRunAtForegroundPriority = false; m_webPageProxy.dataTaskWithRequest(WTFMove(request), topOrigin, shouldRunAtForegroundPriority, [weakThis, completionHandler = WTFMove(completionHandler)] (Ref<API::DataTask>&& task) mutable { if (!weakThis) return completionHandler(); auto protectedThis = weakThis.get(); Page.cpp:4058 [weakThis = WeakPtr { *this }, paymentHandlerPtr = &paymentHandler] (std::optional<bool>&& result) { auto protectedThis = weakThis.get(); PlatformXRSystem.cpp:129: xrCoordinator->requestPermissionOnSessionFeatures(m_page, securityOriginData, mode, granted, consentRequired, consentOptional, requiredFeaturesRequested, optionalFeaturesRequested, [weakThis = WeakPtr { *this }, mode, securityOriginData, consentRequired, completionHandler = WTFMove(completionHandler)](std::optional<PlatformXR::Device::FeatureList>&& grantedFeatures) mutable { ASSERT(RunLoop::isMain()); auto protectedThis = weakThis.get(); PlatformXRSystem.cpp:192 (non-issue) ensureOnMainRunLoop([weakThis = WeakPtr { *this }, deviceIdentifier]() mutable { auto protectedThis = weakThis.get(); PlatformXRSystem.cpp:206 (non-issue) PlatformXRSystem::sessionDidUpdateVisibilityState(XRDeviceIdentifier deviceIdentifier, PlatformXR::VisibilityState visibilityState) { ensureOnMainRunLoop([weakThis = WeakPtr { *this }, deviceIdentifier, visibilityState]() mutable { auto protectedThis = weakThis.get();
<rdar://problem/125952102>