"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xbmc/pvr/channels/PVRChannelGroupInternal.cpp" between
xbmc-19.0-Matrix.tar.gz and xbmc-19.1.tar.gz

About:

PVRChannelGroupInternal.cpp  (xbmc-19.0-Matrix):PVRChannelGroupInternal.cpp  (xbmc-19.1)
skipping to change at line 286 skipping to change at line 286
SortAndRenumber(); SortAndRenumber();
return bReturn; return bReturn;
} }
std::vector<std::shared_ptr<CPVRChannel>> CPVRChannelGroupInternal::RemoveDelete dChannels(const CPVRChannelGroup& channels) std::vector<std::shared_ptr<CPVRChannel>> CPVRChannelGroupInternal::RemoveDelete dChannels(const CPVRChannelGroup& channels)
{ {
std::vector<std::shared_ptr<CPVRChannel>> removedChannels = CPVRChannelGroup:: RemoveDeletedChannels(channels); std::vector<std::shared_ptr<CPVRChannel>> removedChannels = CPVRChannelGroup:: RemoveDeletedChannels(channels);
if (!removedChannels.empty()) if (!removedChannels.empty())
{ {
bool channelsDeleted = false;
const std::shared_ptr<CPVRDatabase> database = CServiceBroker::GetPVRManager ().GetTVDatabase(); const std::shared_ptr<CPVRDatabase> database = CServiceBroker::GetPVRManager ().GetTVDatabase();
if (!database) if (!database)
{ {
CLog::LogF(LOGERROR, "No TV database"); CLog::LogF(LOGERROR, "No TV database");
} }
else else
{ {
std::vector<std::shared_ptr<CPVREpg>> epgsToRemove; std::vector<std::shared_ptr<CPVREpg>> epgsToRemove;
for (const auto& channel : removedChannels) for (const auto& channel : removedChannels)
skipping to change at line 310 skipping to change at line 308
if (epg) if (epg)
epgsToRemove.emplace_back(epg); epgsToRemove.emplace_back(epg);
// Note: We need to obtain a lock for every channel instance before we c an lock // Note: We need to obtain a lock for every channel instance before we c an lock
// the TV db. This order is important. Otherwise deadlocks may occ ur. // the TV db. This order is important. Otherwise deadlocks may occ ur.
channel->Lock(); channel->Lock();
} }
// Note: We must lock the db the whole time, otherwise races may occur. // Note: We must lock the db the whole time, otherwise races may occur.
database->Lock(); database->Lock();
bool commitPending = false;
if (Size() == 0)
{
// Group is empty. Delete all group members from the database.
commitPending = database->QueueDeleteChannelGroupMembersQuery(GroupID())
;
}
for (const auto& channel : removedChannels) for (const auto& channel : removedChannels)
{ {
// since channel was not found in the internal group, it was deleted fro m the backend // since channel was not found in the internal group, it was deleted fro m the backend
channelsDeleted |= channel->QueueDelete(); commitPending |= channel->QueueDelete();
channel->Unlock(); channel->Unlock();
size_t queryCount = database->GetDeleteQueriesCount(); size_t queryCount = database->GetDeleteQueriesCount();
if (queryCount > CHANNEL_COMMIT_QUERY_COUNT_LIMIT) if (queryCount > CHANNEL_COMMIT_QUERY_COUNT_LIMIT)
database->CommitDeleteQueries(); database->CommitDeleteQueries();
} }
if (channelsDeleted) if (commitPending)
database->CommitDeleteQueries(); database->CommitDeleteQueries();
database->Unlock(); database->Unlock();
// delete the EPG data for the removed channels // delete the EPG data for the removed channels
CServiceBroker::GetPVRManager().EpgContainer().QueueDeleteEpgs(epgsToRemov e); CServiceBroker::GetPVRManager().EpgContainer().QueueDeleteEpgs(epgsToRemov e);
} }
} }
return removedChannels; return removedChannels;
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)