From becb32840a87d0f66fe7a57818b28be9c94b5f7e Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Mon, 23 Sep 2013 00:34:39 +0200 Subject: [PATCH] lastfm: queueJob: fix forwarding --- src/lastfm.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lastfm.h b/src/lastfm.h index 380c35f9..344bc8d0 100644 --- a/src/lastfm.h +++ b/src/lastfm.h @@ -51,14 +51,16 @@ struct Lastfm: Screen, Tabbable virtual bool isMergable() OVERRIDE { return true; } template - void queueJob(ServiceT service) + void queueJob(ServiceT &&service) { - auto old_service = dynamic_cast(m_service.get()); + typedef typename std::remove_reference::type ServiceNoRef; + + auto old_service = dynamic_cast(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(std::forward(service)); + m_service = std::make_shared(std::forward(service)); m_worker = boost::async(boost::launch::async, boost::bind(&LastFm::Service::fetch, m_service.get())); w.clear();