Title: [269432] trunk/Source/WebCore
Revision
269432
Author
[email protected]
Date
2020-11-05 08:12:05 -0800 (Thu, 05 Nov 2020)

Log Message

Use std::exchange instead of WTFMove to avoid using members after moving them in NavigationScheduler.cpp
https://bugs.webkit.org/show_bug.cgi?id=218597

Patch by Alex Christensen <[email protected]> on 2020-11-05
Reviewed by Wenson Hsieh.

This shouldn't change behavior, but it leaves the members in a defined state.

* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::timerFired):
(WebCore::NavigationScheduler::cancel):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269431 => 269432)


--- trunk/Source/WebCore/ChangeLog	2020-11-05 15:35:32 UTC (rev 269431)
+++ trunk/Source/WebCore/ChangeLog	2020-11-05 16:12:05 UTC (rev 269432)
@@ -1,3 +1,16 @@
+2020-11-05  Alex Christensen  <[email protected]>
+
+        Use std::exchange instead of WTFMove to avoid using members after moving them in NavigationScheduler.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=218597
+
+        Reviewed by Wenson Hsieh.
+
+        This shouldn't change behavior, but it leaves the members in a defined state.
+
+        * loader/NavigationScheduler.cpp:
+        (WebCore::NavigationScheduler::timerFired):
+        (WebCore::NavigationScheduler::cancel):
+
 2020-11-05  Zalan Bujtas  <[email protected]>
 
         [LFC][Integration] Add visual support for text-overflow: ellipsis

Modified: trunk/Source/WebCore/loader/NavigationScheduler.cpp (269431 => 269432)


--- trunk/Source/WebCore/loader/NavigationScheduler.cpp	2020-11-05 15:35:32 UTC (rev 269431)
+++ trunk/Source/WebCore/loader/NavigationScheduler.cpp	2020-11-05 16:12:05 UTC (rev 269432)
@@ -220,7 +220,7 @@
         frameLoadRequest.disableNavigationToInvalidURL();
         frameLoadRequest.setShouldOpenExternalURLsPolicy(shouldOpenExternalURLs());
 
-        auto completionHandler = WTFMove(m_completionHandler);
+        auto completionHandler = std::exchange(m_completionHandler, nullptr);
         frame.loader().changeLocation(WTFMove(frameLoadRequest));
         completionHandler();
     }
@@ -543,7 +543,7 @@
 
     Ref<Frame> protect(m_frame);
 
-    std::unique_ptr<ScheduledNavigation> redirect = WTFMove(m_redirect);
+    std::unique_ptr<ScheduledNavigation> redirect = std::exchange(m_redirect, nullptr);
     LOG(History, "NavigationScheduler %p timerFired - firing redirect %p", this, redirect.get());
 
     redirect->fire(m_frame);
@@ -602,7 +602,7 @@
         InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
     m_timer.stop();
 
-    if (auto redirect = WTFMove(m_redirect))
+    if (auto redirect = std::exchange(m_redirect, nullptr))
         redirect->didStopTimer(m_frame, newLoadInProgress);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to