DescriptionFix WebStateListObserver::WebStateDetachedAt() parameter lifetime.
The WebState pointer passed to WebStateListObserver::WebStateDetachedAt()
was a pointer to deallocated memory if WebStateList managed the ownership
of the WebState because destroying the WebStateListWrapper deallocated it.
Change WebStateList::DetachWebStateAt() to release the ownership of the
WebState and mark the method (and WebStateList::ReplaceWebStateAt) with
WARN_UNUSED_RESULT so that compiler ensure client code uses the returned
value (by passing it to a std::unique_ptr<> for example).
Change how the lifetime of the WebState is managed in WebStateList to
avoid making the same class of errors in the future (still not optimal
as the best would be to use std::unique_ptr<> but it is not possible
until Tab* and WebState* ownership is reversed).
BUG=687207
Review-Url: https://codereview.chromium.org/2710183003
Cr-Commit-Position: refs/heads/master@{#453790}
Committed: https://chromium.googlesource.com/chromium/src/+/977ff883dfd769b8b79bdb73ed3544b5fa971abb
Patch Set 1 #
Total comments: 2
Patch Set 2 : Mark WebStateList::WebStateWrapper constructor as explicit. #
Total comments: 4
Patch Set 3 : Fix typos. #
Messages
Total messages: 28 (17 generated)
|