summaryrefslogtreecommitdiff
path: root/chromium/components/update_client/task_update.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/update_client/task_update.cc')
-rw-r--r--chromium/components/update_client/task_update.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/chromium/components/update_client/task_update.cc b/chromium/components/update_client/task_update.cc
index 733649b5711..4d78c55fbb3 100644
--- a/chromium/components/update_client/task_update.cc
+++ b/chromium/components/update_client/task_update.cc
@@ -57,9 +57,16 @@ std::vector<std::string> TaskUpdate::GetIds() const {
void TaskUpdate::TaskComplete(Error error) {
DCHECK(thread_checker_.CalledOnValidThread());
+ // NOTE: Do not post the callback_ directly to the task thread to ensure the
+ // UpdateClient reference (to which the callback is bound) does not get
+ // released before the callback is run during shutdown, when the task runner
+ // gets destroyed.
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::BindOnce(std::move(callback_), base::WrapRefCounted(this), error));
+ FROM_HERE, base::BindOnce(&TaskUpdate::RunCallback, this, error));
+}
+
+void TaskUpdate::RunCallback(Error error) {
+ std::move(callback_).Run(this, error);
}
} // namespace update_client