Commit 69165c19 authored by Keishi Hattori's avatar Keishi Hattori Committed by Chromium LUCI CQ

Fix destruction order in LocalStorageImpl::StorageAreaHolder for BackupRefPtr

When BackupRefPtr is used for LocalStorageImpl::StorageAreaHolder::area_ptr_, the destruction order of the fields causes a null dereference.

~StorageAreaHolder() ends up calling StorageAreaHolder::PrepareToCommit() which tries to use area_ptr_ without a null check

Bug: 1080832
Change-Id: Iff06bbf440eb5a3d26226c85b13b36ac037f1fca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2564932Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834641}
parent e724b293
...@@ -431,12 +431,12 @@ class LocalStorageImpl::StorageAreaHolder final ...@@ -431,12 +431,12 @@ class LocalStorageImpl::StorageAreaHolder final
LocalStorageImpl* context_; LocalStorageImpl* context_;
url::Origin origin_; url::Origin origin_;
std::unique_ptr<StorageAreaImpl> area_;
// Holds the same value as |area_|. The reason for this is that // Holds the same value as |area_|. The reason for this is that
// during destruction of the StorageAreaImpl instance we might still get // during destruction of the StorageAreaImpl instance we might still get
// called and need access to the StorageAreaImpl instance. The unique_ptr // called and need access to the StorageAreaImpl instance. The unique_ptr
// could already be null, but this field should still be valid. // could already be null, but this field should still be valid.
StorageAreaImpl* area_ptr_; StorageAreaImpl* area_ptr_;
std::unique_ptr<StorageAreaImpl> area_;
bool deleted_old_data_ = false; bool deleted_old_data_ = false;
bool has_bindings_ = false; bool has_bindings_ = false;
}; };
......
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