Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 742bb977 authored by Roshan Pius's avatar Roshan Pius
Browse files

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
parent bc662205
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
}
+2 −1
Original line number Diff line number Diff line
@@ -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.
+3 −0
Original line number Diff line number Diff line
@@ -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: