Merge "Fix a bug that would access uninitialized data." into tm-dev

This commit is contained in:
TreeHugger Robot
2022-05-09 15:54:38 +00:00
committed by Android (Google) Code Review

View File

@@ -995,11 +995,15 @@ Result<std::vector<uint8_t>> FakeVehicleHardware::parseHexString(const std::stri
template <class CallbackType, class RequestType>
FakeVehicleHardware::PendingRequestHandler<CallbackType, RequestType>::PendingRequestHandler(
FakeVehicleHardware* hardware)
: mHardware(hardware), mThread([this] {
while (mRequests.waitForItems()) {
handleRequestsOnce();
}
}) {}
: mHardware(hardware) {
// Don't initialize mThread in initialization list because mThread depends on mRequests and we
// want mRequests to be initialized first.
mThread = std::thread([this] {
while (mRequests.waitForItems()) {
handleRequestsOnce();
}
});
}
template <class CallbackType, class RequestType>
void FakeVehicleHardware::PendingRequestHandler<CallbackType, RequestType>::addRequest(