Copy assertions before iterating over them in _notifyAssertionsOfImminentSuspension.
<rdar://problem/57265830>
Created attachment 384166 [details] Patch
Comment on attachment 384166 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=384166&action=review > Source/WebKit/ChangeLog:13 > + them. It is common for process assertions to get released when uiAssertionWillExpireImminently() > + gets called, which would remove them from the _assertionsNeedingBackgroundTask vector we were > + iterating on. Is it possible to assertions to be added to the vector while iterating?
(In reply to Alexey Proskuryakov from comment #3) > Comment on attachment 384166 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=384166&action=review > > > Source/WebKit/ChangeLog:13 > > + them. It is common for process assertions to get released when uiAssertionWillExpireImminently() > > + gets called, which would remove them from the _assertionsNeedingBackgroundTask vector we were > > + iterating on. > > Is it possible to assertions to be added to the vector while iterating? Not as far as I know, we're telling the clients that their assertion has expired and they're supposed to abort whatever they're doing (and release their assertion). The "release their assertion" is logic I added recently, which is why this regressed.
Comment on attachment 384166 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=384166&action=review > Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:115 > + Vector<WeakPtr<ProcessAndUIAssertion>> assertionsNeedingBackgroundTask = WTF::map(_assertionsNeedingBackgroundTask, [](auto* assertion) { Seems worth explaining in a comment why we don't expect anything to be added to _assertionsNeedingBackgroundTask while iterating - or maybe even ASSERT at the end that there isn't anything new.
Committed r252811: <https://trac.webkit.org/changeset/252811>