RESOLVED FIXED 237265
WTF::SentinelLinkedList::iterator should have operator++ for range-for loop
https://bugs.webkit.org/show_bug.cgi?id=237265
Summary WTF::SentinelLinkedList::iterator should have operator++ for range-for loop
Fujii Hironori
Reported 2022-02-27 22:01:43 PST
WTF::SentinelLinkedList has three problems. Even though it has begin() and end(), using SentinelLinkedList with range-for loop results in a broken node because iterator::operator++ doesn't work as expected. If I use a SentinelLinkedList in a movable type, the sentinel pointer gets stale. It doesn't have const_iterator.
Attachments
Patch (13.37 KB, patch)
2022-02-27 22:10 PST, Fujii Hironori
no flags
Patch (13.45 KB, patch)
2022-02-28 04:20 PST, Fujii Hironori
ews-feeder: commit-queue-
Patch (14.94 KB, patch)
2022-02-28 05:09 PST, Fujii Hironori
no flags
Patch for landing (18.38 KB, patch)
2022-03-01 13:28 PST, Fujii Hironori
no flags
Fujii Hironori
Comment 1 2022-02-27 22:10:01 PST
Fujii Hironori
Comment 2 2022-02-28 04:20:07 PST
Fujii Hironori
Comment 3 2022-02-28 05:09:23 PST
Yusuke Suzuki
Comment 4 2022-02-28 21:48:49 PST
Comment on attachment 453382 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453382&action=review r=me > Source/WTF/wtf/SentinelLinkedList.h:89 > + BaseIterator(RawNodeType* node) Let's make it `explicit` constructor.
Fujii Hironori
Comment 5 2022-03-01 12:04:47 PST
Comment on attachment 453382 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453382&action=review Thank you very much for the review. >> Source/WTF/wtf/SentinelLinkedList.h:89 >> + BaseIterator(RawNodeType* node) > > Let's make it `explicit` constructor. It's a good idea. But, I did this because there are some existing code assuming an iterator can compare with a node pointer. But, It seeds a bad idea comparing an iterator without deference. I'm going to rewrite them.
Fujii Hironori
Comment 6 2022-03-01 13:28:42 PST
Created attachment 453534 [details] Patch for landing
Fujii Hironori
Comment 7 2022-03-01 15:51:42 PST
Comment on attachment 453534 [details] Patch for landing Clearing flags on attachment: 453534 Committed r290705 (247954@trunk): <https://commits.webkit.org/247954@trunk>
Fujii Hironori
Comment 8 2022-03-01 15:51:48 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2022-03-01 15:52:17 PST
Note You need to log in before you can comment on or make changes to this bug.