lastfm: queueJob: fix forwarding
This commit is contained in:
@@ -51,14 +51,16 @@ struct Lastfm: Screen<NC::Scrollpad>, Tabbable
|
||||
virtual bool isMergable() OVERRIDE { return true; }
|
||||
|
||||
template <typename ServiceT>
|
||||
void queueJob(ServiceT service)
|
||||
void queueJob(ServiceT &&service)
|
||||
{
|
||||
auto old_service = dynamic_cast<ServiceT *>(m_service.get());
|
||||
typedef typename std::remove_reference<ServiceT>::type ServiceNoRef;
|
||||
|
||||
auto old_service = dynamic_cast<ServiceNoRef *>(m_service.get());
|
||||
// if the same service and arguments were used, leave old info
|
||||
if (old_service != nullptr && *old_service == service)
|
||||
return;
|
||||
|
||||
m_service = std::make_shared<ServiceT>(std::forward<ServiceT>(service));
|
||||
m_service = std::make_shared<ServiceNoRef>(std::forward<ServiceT>(service));
|
||||
m_worker = boost::async(boost::launch::async, boost::bind(&LastFm::Service::fetch, m_service.get()));
|
||||
|
||||
w.clear();
|
||||
|
||||
Reference in New Issue
Block a user