OSDN Git Service

SM: Reset fixed channel service pointer so we could continue
authorMartin Brabham <optedoblivion@google.com>
Wed, 11 Mar 2020 02:36:07 +0000 (19:36 -0700)
committerMartin Brabham <optedoblivion@google.com>
Fri, 13 Mar 2020 00:07:09 +0000 (00:07 +0000)
Bug:
Test: bluetooth_test_gd
Change-Id: I326ee8f8206d139fadb4585a47832e2a0416dd4a

gd/security/channel/security_manager_channel.cc

index 81bdda1..c07446c 100644 (file)
@@ -57,6 +57,7 @@ SecurityManagerChannel::~SecurityManagerChannel() {
   if (fixed_channel_service_ != nullptr) {
     fixed_channel_service_->Unregister(common::Bind(&SecurityManagerChannel::OnUnregistered, common::Unretained(this)),
                                        handler_);
+    fixed_channel_service_.reset();
   }
 }
 
@@ -132,7 +133,6 @@ void SecurityManagerChannel::OnConnectionFail(hci::Address address,
             result.connection_result_code);
   auto entry = fixed_channel_map_.find(address);
   if (entry != fixed_channel_map_.end()) {
-    entry->second->Release();
     entry->second.reset();
     fixed_channel_map_.erase(entry);
   }
@@ -144,7 +144,6 @@ void SecurityManagerChannel::OnConnectionClose(hci::Address address, hci::ErrorC
   LOG_ERROR("Connection closed due to: %s", hci::ErrorCodeText(error_code).c_str());
   auto entry = fixed_channel_map_.find(address);
   if (entry != fixed_channel_map_.end()) {
-    entry->second->Release();
     entry->second.reset();
     fixed_channel_map_.erase(entry);
   }