Commit 38c31d1c authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

Recreate the DB and metatable before we try to reinitialise

Fixes a DCHECK crash where the MetaTable has already
been created and we try to reuse it for the new DB.

Change-Id: Ib1b0a96ae4a65fa606872cb10ad3f5183ee02558
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2357750Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798363}
parent c9a5d7ef
...@@ -315,8 +315,8 @@ void MediaHistoryStore::Initialize(const bool should_reset) { ...@@ -315,8 +315,8 @@ void MediaHistoryStore::Initialize(const bool should_reset) {
// In some edge cases the DB might be corrupted and unrecoverable so we should // In some edge cases the DB might be corrupted and unrecoverable so we should
// delete the database and recreate it. // delete the database and recreate it.
if (result != InitResult::kSuccess) { if (result != InitResult::kSuccess) {
if (db_->is_open()) db_ = std::make_unique<sql::Database>();
db_->Close(); meta_table_ = std::make_unique<sql::MetaTable>();
sql::Database::Delete(db_path_); sql::Database::Delete(db_path_);
......
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