Fix crash on shutdown when update in progress.
The ActionProcessor destructor normally calls the ProcessingStop method
on the delegate. For the UpdateAttempter this call re-schedules a new
update attempt on a half-destroyed update_attempter instance, crashing
update_engine on SIGTERM when the ActionProcessor was running.
This patch inhibits the ActionProcessor from notifying the delegate of
the processor stopping when destroying the update_attempter instance.
It also fixes the declaration order of the dbus_adaptor_ and disables
its usage during daemon shutdown.
Bug: 24989397
TEST=start update-engine; (update_engine_client --update &); sleep 6; stop update-engine; tail /var/log/update_engine.log
TEST=FEATURES=test emerge-link update_engine
Change-Id: I0a40067f63e89759ff80c79cecb6f89b10dba0c2
diff --git a/update_attempter.cc b/update_attempter.cc
index 3cdd613..93fda66 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -129,6 +129,9 @@
UpdateAttempter::~UpdateAttempter() {
CleanupCpuSharesManagement();
+ // Release ourselves as the ActionProcessor's delegate to prevent
+ // re-scheduling the updates due to the processing stopped.
+ processor_->set_delegate(nullptr);
}
void UpdateAttempter::Init() {