Unreviewed, a followup after r242336
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Mar 2019 23:49:58 +0000 (23:49 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Mar 2019 23:49:58 +0000 (23:49 +0000)
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::webViewDidMoveToWindow):
Copy the list of observers before iterating it to avoid observers modifying the list.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242398 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.cpp

index 4544814..1fcc23e 100644 (file)
@@ -1,3 +1,11 @@
+2019-03-04  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Unreviewed, a followup after r242336
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::webViewDidMoveToWindow):
+        Copy the list of observers before iterating it to avoid observers modifying the list.
+
 2019-03-04  Truitt Savell  <tsavell@apple.com>
 
         Unreviewed, rolling out r242222.
index 24550e4..1f39c14 100644 (file)
@@ -8795,7 +8795,8 @@ void WebPageProxy::removeObserver(WebViewDidMoveToWindowObserver& observer)
 
 void WebPageProxy::webViewDidMoveToWindow()
 {
-    for (const auto& observer : m_webViewDidMoveToWindowObservers) {
+    auto observersCopy = m_webViewDidMoveToWindowObservers;
+    for (const auto& observer : observersCopy) {
         if (!observer.value)
             continue;
         observer.value->webViewDidMoveToWindow();