Commit 25482c74 authored by David Jean's avatar David Jean Committed by Commit Bot

[ios] Fix reading list crash on shut down

Bug: 1108308
Change-Id: I1c0d7db1d5451f893736a9c59c9ec7a5b3b5edbd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2351776Reviewed-by: default avatarEric Noyau <noyau@chromium.org>
Commit-Queue: David Jean <djean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797179}
parent 54b8c1d0
......@@ -224,12 +224,17 @@ void OfflinePageTabHelper::ReadingListModelLoaded(
void OfflinePageTabHelper::ReadingListModelBeingDeleted(
const ReadingListModel* model) {
DCHECK(reading_list_model_ == nullptr || reading_list_model_ == model);
// Detach will nullify web_state_, this keeps it local a bit longer
// to allow removing user data below.
web::WebState* webState = web_state_;
Detach();
// The call to RemoveUserData cause the destruction of the current instance,
// so nothing should be done after that point (this is like "delete this;").
// Unregistration as an observer happens in the destructor.
web_state_->RemoveUserData(UserDataKey());
webState->RemoveUserData(UserDataKey());
}
void OfflinePageTabHelper::PresentOfflinePageForOnlineUrl(const GURL& url) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment