wifi(implementation): Copy the user complete callback by value

The callback object may go out of scope by the time it's invoked. So,
make a copy of it. We're doing the same for the other user callbacks
received in this class.

Bug: 34930275
Test: Compiles
Change-Id: I275bba11ae8735a21514d871e8aa473f92f0fd7d
This commit is contained in:
Roshan Pius 2017-02-02 09:54:27 -08:00
parent bc662205c6
commit 742bb97769
3 changed files with 7 additions and 3 deletions

View file

@ -27,7 +27,7 @@ using android::hardware::joinRpcThreadpool;
int main(int /*argc*/, char** argv) {
android::base::InitLogging(argv,
android::base::LogdLogger(android::base::SYSTEM));
LOG(INFO) << "wifi_hal_legacy is starting up...";
LOG(INFO) << "Wifi Hal is starting up...";
configureRpcThreadpool(1, true /* callerWillJoin */);
@ -39,6 +39,6 @@ int main(int /*argc*/, char** argv) {
joinRpcThreadpool();
LOG(INFO) << "wifi_hal_legacy is terminating...";
LOG(INFO) << "Wifi Hal is terminating...";
return 0;
}

View file

@ -350,7 +350,8 @@ wifi_error WifiLegacyHal::stop(
return WIFI_SUCCESS;
}
LOG(DEBUG) << "Stopping legacy HAL";
on_stop_complete_internal_callback = [&](wifi_handle handle) {
on_stop_complete_internal_callback = [on_stop_complete_user_callback,
this](wifi_handle handle) {
CHECK_EQ(global_handle_, handle) << "Handle mismatch";
// Invalidate all the internal pointers now that the HAL is
// stopped.

View file

@ -124,6 +124,9 @@ using on_error_alert_callback =
/**
* Class that encapsulates all legacy HAL interactions.
* This class manages the lifetime of the event loop thread used by legacy HAL.
*
* Note: aThere will only be a single instance of this class created in the Wifi
* object and will be valid for the lifetime of the process.
*/
class WifiLegacyHal {
public: