[Webkit-unassigned] [Bug 272212] New: Some raw pointers are named 'protectedThis' which is probably unintentional

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 4 23:21:11 PDT 2024


            Bug ID: 272212
           Summary: Some raw pointers are named 'protectedThis' which is
                    probably unintentional
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mwyrzykowski at apple.com

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:

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();

[weakThis = WeakPtr { *this }, paymentHandlerPtr = &paymentHandler] (std::optional<bool>&& result) {
        auto protectedThis = weakThis.get();

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 {
        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();

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240405/b938c627/attachment.htm>

More information about the webkit-unassigned mailing list