update_engine: Remove Action object from FilesystemVerifierActionDelegate
in CL:1065113 we forgot to remove the FileSystemVerfierAction instance from the
FilesystemVerifierActionDelegate. Hence, it will be removed from memory while
FilesystemVerifierActionDelegate still keeps a pointer to it and access it. This
causes a possible race condition on ExitMainLoop() function. This patch fixes
the issue by removing that instance and the unnecessary checks for the
cleanup. Once the Action is deleted by the ActionProcessor it will be cleaned up
(which will happen when the action is terminated too). So there is not really a
need for testing the cleanup method.
BUG=chromium:867815
TEST=unittests pass
Change-Id: Id9d3f361eb916007e95dbb1d0adb9603ceae00b9
Reviewed-on: https://chromium-review.googlesource.com/1151902
Commit-Ready: Lann Martin <lannm@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/payload_consumer/filesystem_verifier_action.h b/payload_consumer/filesystem_verifier_action.h
index 616f7b7..a21fc2a 100644
--- a/payload_consumer/filesystem_verifier_action.h
+++ b/payload_consumer/filesystem_verifier_action.h
@@ -20,6 +20,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <memory>
#include <string>
#include <vector>
@@ -54,17 +55,12 @@
void PerformAction() override;
void TerminateProcessing() override;
- // Used for testing. Return true if Cleanup() has not yet been called due
- // to a callback upon the completion or cancellation of the verifier action.
- // A test should wait until IsCleanupPending() returns false before
- // terminating the main loop.
- bool IsCleanupPending() const;
-
// Debugging/logging
static std::string StaticType() { return "FilesystemVerifierAction"; }
std::string Type() const override { return StaticType(); }
private:
+ friend class FilesystemVerifierActionTestDelegate;
// Starts the hashing of the current partition. If there aren't any partitions
// remaining to be hashed, it finishes the action.
void StartPartitionHashing();