Title: [198940] trunk/Source/WebCore
Revision
198940
Author
[email protected]
Date
2016-03-31 21:54:02 -0700 (Thu, 31 Mar 2016)

Log Message

Page overlay tests sometimes crash under MockPageOverlayClient::uninstallAllOverlays()
https://bugs.webkit.org/show_bug.cgi?id=156080
rdar://problem/24922183

Reviewed by Alex Christensen.

Make MockPageOverlayClient::m_overlays reference the overlays. There is no reference
cycle because they are all removed between test page loads.

* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::uninstallAllOverlays):
(WebCore::MockPageOverlayClient::pageOverlayDestroyed):
* testing/MockPageOverlayClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (198939 => 198940)


--- trunk/Source/WebCore/ChangeLog	2016-04-01 04:52:30 UTC (rev 198939)
+++ trunk/Source/WebCore/ChangeLog	2016-04-01 04:54:02 UTC (rev 198940)
@@ -1,3 +1,19 @@
+2016-03-31  Alexey Proskuryakov  <[email protected]>
+
+        Page overlay tests sometimes crash under MockPageOverlayClient::uninstallAllOverlays()
+        https://bugs.webkit.org/show_bug.cgi?id=156080
+        rdar://problem/24922183
+
+        Reviewed by Alex Christensen.
+
+        Make MockPageOverlayClient::m_overlays reference the overlays. There is no reference
+        cycle because they are all removed between test page loads.
+
+        * testing/MockPageOverlayClient.cpp:
+        (WebCore::MockPageOverlayClient::uninstallAllOverlays):
+        (WebCore::MockPageOverlayClient::pageOverlayDestroyed):
+        * testing/MockPageOverlayClient.h:
+
 2016-03-31  Daniel Bates  <[email protected]>
 
         REGRESSION (r197724): <object>/<embed> with no URL does not match source *

Modified: trunk/Source/WebCore/testing/MockPageOverlayClient.cpp (198939 => 198940)


--- trunk/Source/WebCore/testing/MockPageOverlayClient.cpp	2016-04-01 04:52:30 UTC (rev 198939)
+++ trunk/Source/WebCore/testing/MockPageOverlayClient.cpp	2016-04-01 04:54:02 UTC (rev 198940)
@@ -61,7 +61,7 @@
 void MockPageOverlayClient::uninstallAllOverlays()
 {
     while (!m_overlays.isEmpty()) {
-        MockPageOverlay* mockOverlay = m_overlays.takeAny();
+        RefPtr<MockPageOverlay> mockOverlay = m_overlays.takeAny();
         PageOverlayController* overlayController = mockOverlay->overlay()->controller();
         ASSERT(overlayController);
         overlayController->uninstallPageOverlay(mockOverlay->overlay(), PageOverlay::FadeMode::DoNotFade);
@@ -75,6 +75,9 @@
 
 void MockPageOverlayClient::pageOverlayDestroyed(PageOverlay& overlay)
 {
+    // FIXME: This is dead code, nothing ever calls this function. It's not clear to me what the intention was,
+    // since MockPageOverlayClient has references to MockPageOverlays, not to PageOverlays.
+    // Also, iterating over a set while modifying it is not good.
     for (auto& mockOverlay : m_overlays) {
         if (mockOverlay->overlay() == &overlay) {
             m_overlays.remove(mockOverlay);

Modified: trunk/Source/WebCore/testing/MockPageOverlayClient.h (198939 => 198940)


--- trunk/Source/WebCore/testing/MockPageOverlayClient.h	2016-04-01 04:52:30 UTC (rev 198939)
+++ trunk/Source/WebCore/testing/MockPageOverlayClient.h	2016-04-01 04:54:02 UTC (rev 198940)
@@ -60,7 +60,7 @@
     bool copyAccessibilityAttributeBoolValueForPoint(PageOverlay&, String /* attribute */, FloatPoint, bool&) override;
     Vector<String> copyAccessibilityAttributeNames(PageOverlay&, bool /* parameterizedNames */) override;
 
-    HashSet<MockPageOverlay*> m_overlays;
+    HashSet<RefPtr<MockPageOverlay>> m_overlays;
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to