summaryrefslogtreecommitdiff
path: root/chromium/components/history/core/browser/history_backend.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/history/core/browser/history_backend.cc')
-rw-r--r--chromium/components/history/core/browser/history_backend.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chromium/components/history/core/browser/history_backend.cc b/chromium/components/history/core/browser/history_backend.cc
index ab9df06777a..6470d31cb1c 100644
--- a/chromium/components/history/core/browser/history_backend.cc
+++ b/chromium/components/history/core/browser/history_backend.cc
@@ -276,6 +276,15 @@ HistoryBackend::~HistoryBackend() {
// Release stashed embedder object before cleaning up the databases.
supports_user_data_helper_.reset();
+ // Clear the error callback. The error callback that is installed does not
+ // process an error immediately, rather it uses a PostTask() with `this`. As
+ // `this` is being deleted, scheduling a PostTask() with `this` would be
+ // fatal (use-after-free). Additionally, as we're in shutdown, there isn't
+ // much point in trying to handle the error. If the error is really fatal,
+ // we'll cleanup the next time the backend is created.
+ if (db_)
+ db_->reset_error_callback();
+
// First close the databases before optionally running the "destroy" task.
CloseAllDatabases();