Skip to content

Commit

Permalink
Fix invalid inheritance of enable_shared_from_this
Browse files Browse the repository at this point in the history
  • Loading branch information
f1xpl committed Apr 5, 2018
1 parent cf3a5e5 commit a0b2418
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/f1x/openauto/autoapp/Projection/Pinger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions src/autoapp/Projection/AndroidAutoEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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()]() {
Expand Down

0 comments on commit a0b2418

Please sign in to comment.