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
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index 40f55a3..cd89acc 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -350,7 +350,8 @@
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.