⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 282503 in webkit


Ignore:
Timestamp:
Sep 16, 2021, 1:14:44 AM (5 years ago)
Author:
Adrian Perez de Castro
Message:

Merge r275972 - Crash in ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds()
​https://bugs.webkit.org/show_bug.cgi?id=224520

Patch by Julian Gonzalez <​julian_a_gonzalez@apple.com> on 2021-04-14
Reviewed by Ryosuke Niwa.

Adopt RefPtr<Node> instead of using plain Node* here to avoid a crash.

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds):

Location:
releases/WebKitGTK/webkit-2.32/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog

    r282502 r282503  
     12021-04-14  Julian Gonzalez  <julian_a_gonzalez@apple.com>
     2
     3        Crash in ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds()
     4        https://bugs.webkit.org/show_bug.cgi?id=224520
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Adopt RefPtr<Node> instead of using plain Node* here to avoid a crash.
     9
     10        * editing/ReplaceSelectionCommand.cpp:
     11        (WebCore::ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds):
     12
    1132021-04-14  Carlos Garcia Campos  <cgarcia@igalia.com>
    214
  • releases/WebKitGTK/webkit-2.32/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r280896 r282503  
    829829    document().updateLayoutIgnorePendingStylesheets();
    830830
    831     Node* lastLeafInserted = insertedNodes.lastLeafInserted();
     831    auto lastLeafInserted = makeRefPtr(insertedNodes.lastLeafInserted());
    832832    if (is<Text>(lastLeafInserted) && !hasRenderedText(downcast<Text>(*lastLeafInserted))
    833         && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted), selectTag)
    834         && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted), scriptTag)) {
    835         insertedNodes.willRemoveNode(lastLeafInserted);
     833        && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted.get()), selectTag)
     834        && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted.get()), scriptTag)) {
     835        insertedNodes.willRemoveNode(lastLeafInserted.get());
    836836        removeNode(*lastLeafInserted);
    837837    }
    … …  
    841841    // We don't have to make sure that firstNodeInserted isn't inside a select or script element
    842842    // because it is a top level node in the fragment and the user can't insert into those elements.
    843     Node* firstNodeInserted = insertedNodes.firstNodeInserted();
     843    auto firstNodeInserted = makeRefPtr(insertedNodes.firstNodeInserted());
    844844    if (is<Text>(firstNodeInserted) && !hasRenderedText(downcast<Text>(*firstNodeInserted))) {
    845         insertedNodes.willRemoveNode(firstNodeInserted);
     845        insertedNodes.willRemoveNode(firstNodeInserted.get());
    846846        removeNode(*firstNodeInserted);
    847847    }
Note: See TracChangeset for help on using the changeset viewer.