update_engine: Fix a memory access violation
Somewhere down in HttpFetcher there is a pointer to
ChromeBrowserProxyResolver. But the actual object gets deleted before
ActionProcessor is deleted. But ActionProcessor's dtor makes calls that
sometimes eventually gets into the instance of ChromeBrowserproxyresolver and we
get a memory violation.
For now just declare ChromeBrowserProxyResolver before ActionProcessor so it
still exists when the ActionProcessor uses it. Later use shared_ptr to properly
handle it.
BUG=chromium:915922
TEST=cros flash
TEST=Instrumented the dtors and manually stopped the update_engine process to
see the order of dtors are correct.
Change-Id: Ie9fa654103605f04c82521c29614dbcd4fb083e8
Reviewed-on: https://chromium-review.googlesource.com/1388105
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/update_attempter_android.h b/update_attempter_android.h
index cad89dc..99aa14e 100644
--- a/update_attempter_android.h
+++ b/update_attempter_android.h
@@ -172,6 +172,9 @@
// set back in the middle of an update.
base::TimeTicks last_notify_time_;
+ // Only direct proxy supported.
+ DirectProxyResolver proxy_resolver_;
+
// The processor for running Actions.
std::unique_ptr<ActionProcessor> processor_;
@@ -190,9 +193,6 @@
// The offset in the payload file where the CrAU part starts.
int64_t base_offset_{0};
- // Only direct proxy supported.
- DirectProxyResolver proxy_resolver_;
-
// Helper class to select the network to use during the update.
std::unique_ptr<NetworkSelectorInterface> network_selector_;