From 97c9eddb4d42332eb52556c617ad317d8749169e Mon Sep 17 00:00:00 2001 From: randomdan Date: Sun, 1 Dec 2013 15:09:05 +0000 Subject: Remove tuner from adapter only when there are no more users --- p2pvr/lib/localDevices.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/p2pvr/lib/localDevices.cpp b/p2pvr/lib/localDevices.cpp index 330271a..5478301 100644 --- a/p2pvr/lib/localDevices.cpp +++ b/p2pvr/lib/localDevices.cpp @@ -105,10 +105,6 @@ LocalDevices::ReleaseTuner(const P2PVR::TunerPrx & tuner, const Ice::Current & i auto openTuner = std::find_if(devices.begin(), devices.end(), [tuner](const Devices::value_type & ot) { return ot.second && ot.second->tuner == tuner; }); - auto id = tuner->ice_getIdentity(); - if (ice.adapter->find(id)) { - ice.adapter->remove(id); - } if (openTuner == devices.end()) { Logger()->messagebf(LOG_DEBUG, "%s: Not one of mine", __PRETTY_FUNCTION__); return; @@ -116,6 +112,10 @@ LocalDevices::ReleaseTuner(const P2PVR::TunerPrx & tuner, const Ice::Current & i Logger()->messagebf(LOG_DEBUG, "%s: Locally owned deivce %s", __PRETTY_FUNCTION__, openTuner->first); openTuner->second->clients -= 1; if (openTuner->second->clients == 0) { + auto id = tuner->ice_getIdentity(); + if (ice.adapter->find(id)) { + ice.adapter->remove(id); + } openTuner->second.reset(); } } -- cgit v1.2.3