[webkit-dev] Watch out for std::optional's move constructor
Geoffrey Garen
ggaren at apple.com
Sat Dec 15 11:24:07 PST 2018
> This expression WTFMove(*m_pendingWebsitePolicies) doesn't move std::optional<WebsitePoliciesData>, but moves the content of the std::optional, WebsitePoliciesData. I think your proposal doesn't work for this code.
The original code, which asserted, did this:
if (auto pendingWebsitePolicies = WTFMove(m_pendingWebsitePolicies))
WebsitePoliciesData::applyToDocumentLoader(WTFMove(*pendingWebsitePolicies), documentLoader);
The relevant expression was "WTFMove(m_pendingWebsitePolicies)”, which did move std::optional<WebsitePoliciesData>. The expectation in the code was that, after WTFMove(m_pendingWebsitePolicies), m_pendingWebsitePolicies would be empty.
Geoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20181215/c03a7a44/attachment-0001.html>
More information about the webkit-dev
mailing list