Fix invalid inheritance of enable_shared_from_this

pull/61/head
michal.szwaj 2018-04-05 18:27:31 +02:00
parent cf3a5e51d7
commit a0b2418022
2 changed files with 3 additions and 7 deletions

View File

@ -29,7 +29,7 @@ namespace autoapp
namespace projection
{
class Pinger: public IPinger, std::enable_shared_from_this<Pinger>
class Pinger: public IPinger, public std::enable_shared_from_this<Pinger>
{
public:
Pinger(boost::asio::io_service& ioService, time_t duration);

View File

@ -79,8 +79,8 @@ void AndroidAutoEntity::stop()
strand_.dispatch([this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "[AndroidAutoEntity] stop.";
pinger_->cancel();
std::for_each(serviceList_.begin(), serviceList_.end(), std::bind(&IService::stop, std::placeholders::_1));
messenger_->stop();
cryptor_->deinit();
transport_->stop();
@ -145,6 +145,7 @@ void AndroidAutoEntity::onHandshake(const aasdk::common::DataConstBuffer& payloa
auto authCompletePromise = aasdk::channel::SendPromise::defer(strand_);
authCompletePromise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
controlServiceChannel_->sendAuthComplete(authCompleteIndication, std::move(authCompletePromise));
this->ping();
}
controlServiceChannel_->receive(this->shared_from_this());
@ -180,8 +181,6 @@ void AndroidAutoEntity::onServiceDiscoveryRequest(const aasdk::proto::messages::
promise->then([]() {}, std::bind(&AndroidAutoEntity::onChannelError, this->shared_from_this(), std::placeholders::_1));
controlServiceChannel_->sendServiceDiscoveryResponse(serviceDiscoveryResponse, std::move(promise));
controlServiceChannel_->receive(this->shared_from_this());
this->ping();
}
void AndroidAutoEntity::onAudioFocusRequest(const aasdk::proto::messages::AudioFocusRequest& request)
@ -237,8 +236,6 @@ void AndroidAutoEntity::onNavigationFocusRequest(const aasdk::proto::messages::N
void AndroidAutoEntity::onPingResponse(const aasdk::proto::messages::PingResponse&)
{
OPENAUTO_LOG(info) << "[AndroidAutoEntity] ping response";
pinger_->pong();
controlServiceChannel_->receive(this->shared_from_this());
}
@ -266,7 +263,6 @@ void AndroidAutoEntity::ping()
aasdk::proto::messages::PingRequest request;
controlServiceChannel_->sendPingRequest(request, std::move(promise));
this->ping();
},
[this, self = this->shared_from_this()]() {