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

Changeset 287048 in webkit


Ignore:
Timestamp:
Dec 14, 2021, 2:15:49 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Adhere to DisplayList iterator's API contract in MemoryDisplayList::~InMemoryDisplayList()
https://bugs.webkit.org/show_bug.cgi?id=234264

Patch by Gabriel Nava Marino <gnavamarino@apple.com> on 2021-12-14
Reviewed by Myles C. Maxfield.

The client is not adhearing to the DisplayList Iterator's API contract in MemoryDisplayList::~InMemoryDisplayList():
"Part of the iterator's API contract is that if the item is nullopt, you're not allowed to keep
iterating - doing this will lead to an infinite loop."

Here we now do so by breaking out of iteration if the item is nullopt.

  • platform/graphics/displaylists/InMemoryDisplayList.cpp:

(WebCore::DisplayList::InMemoryDisplayList::~InMemoryDisplayList):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r287047 r287048  
     12021-12-14  Gabriel Nava Marino  <gnavamarino@apple.com>
     2
     3        Adhere to DisplayList iterator's API contract in MemoryDisplayList::~InMemoryDisplayList()
     4        https://bugs.webkit.org/show_bug.cgi?id=234264
     5
     6        Reviewed by Myles C. Maxfield.
     7
     8        The client is not adhearing to the DisplayList Iterator's API contract in MemoryDisplayList::~InMemoryDisplayList():
     9        "Part of the iterator's API contract is that if the item is nullopt, you're not allowed to keep
     10        iterating - doing this will lead to an infinite loop."
     11
     12        Here we now do so by breaking out of iteration if the item is nullopt.
     13
     14        * platform/graphics/displaylists/InMemoryDisplayList.cpp:
     15        (WebCore::DisplayList::InMemoryDisplayList::~InMemoryDisplayList):
     16
    1172021-12-14  Alan Bujtas  <zalan@apple.com>
    218
  • trunk/Source/WebCore/platform/graphics/displaylists/InMemoryDisplayList.cpp

    r284857 r287048  
    6464    auto end = this->end();
    6565    for (auto displayListItem : *this) {
     66        if (!displayListItem)
     67            break;
    6668        auto item = displayListItem->item;
    6769        ASSERT(item);
Note: See TracChangeset for help on using the changeset viewer.