Branch: refs/heads/webkitglib/2.52
  Home:   https://github.com/WebKit/WebKit
  Commit: 418b52ec02b338aeb280aff6516f77434196a0a8
      
https://github.com/WebKit/WebKit/commit/418b52ec02b338aeb280aff6516f77434196a0a8
  Author: David Kilzer <[email protected]>
  Date:   2026-01-27 (Tue, 27 Jan 2026)

  Changed paths:
    M Source/WebCore/xml/XPathNodeSet.cpp

  Log Message:
  -----------
  Cherry-pick 306240@main (7a9af69f9b93). 
https://bugs.webkit.org/show_bug.cgi?id=306226

    Fix -Wlifetime-safety-permissive warning in XPathNodeSet::findRootNode()
    <https://bugs.webkit.org/show_bug.cgi?id=306226>
    <rdar://problem/168880148>

    Reviewed by Geoffrey Garen.

    Clang's -Wlifetime-safety-permissive warning detected a potential issue
    in the findRootNode() function.

    The fix introduces `RefPtr<Node> current` to maintain proper lifetime
    management throughout the function.  This is necessary because
    `attr->ownerElement()` returns a raw pointer from a `WeakPtr<Element>`,
    so when the `RefPtr attr` goes out of scope after the if statement,
    nothing would keep the ownerElement alive if we stored it in a raw
    pointer.

    Similarly, the while loop's `RefPtr parent` was destroyed at the end of
    each loop iteration while `node` held a raw pointer to it.  The while
    loop is also changed to a for loop to avoid recreating the `RefPtr
    parent` variable on each loop iteration.

    findRootNode() is also changed to inline and to return `RefPtr<Node>`
    since its single caller stores the result in a `RefPtr`.

    No new tests since no change in behavior.

    * Source/WebCore/xml/XPathNodeSet.cpp:
    (WebCore::XPath::findRootNode):

    Canonical link: https://commits.webkit.org/306240@main

Canonical link: https://commits.webkit.org/305877.19@webkitglib/2.52



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to