Fix starter_test under msan
We were running a std::function that was getting deleted while being
run. Convert that over to a reference to prevent the use after free.
Change-Id: Ie646443542e384af841292394397866627d7bf2a
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/starter/starter_rpc_lib.h b/aos/starter/starter_rpc_lib.h
index ae2450c..a949928 100644
--- a/aos/starter/starter_rpc_lib.h
+++ b/aos/starter/starter_rpc_lib.h
@@ -37,8 +37,11 @@
timeout_handler_ = handler;
}
+ // Sets the callback to be called on success. Note: this isn't safe to call
+ // while the previous success handler is running unless you use std::ref to
+ // manage its lifetime some other way.
void SetSuccessHandler(std::function<void()> handler) {
- success_handler_ = handler;
+ success_handler_ = std::move(handler);
}
private: