diff options
author | Martijn Kaijser <martijn@xbmc.org> | 2017-02-01 10:35:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-01 10:35:03 +0100 |
commit | 48e28b6da91f8259b1076c25b2ae86b31c288742 (patch) | |
tree | 5ae94934f620696bc4292368ae50d999dd6b404d | |
parent | 97ed950a97705929253529d8acb921c07455f861 (diff) | |
parent | c34e593c3de12c1df5c612f8cc4e50382a97db97 (diff) |
Merge pull request #11593 from ksooo/krypton-revert-11537
Revert "[PVR] Fix deadlock that might occure during initial channel icon search."
-rw-r--r-- | xbmc/pvr/channels/PVRChannelGroup.cpp | 32 | ||||
-rw-r--r-- | xbmc/pvr/channels/PVRChannelGroup.h | 14 |
2 files changed, 9 insertions, 37 deletions
diff --git a/xbmc/pvr/channels/PVRChannelGroup.cpp b/xbmc/pvr/channels/PVRChannelGroup.cpp index f117f54ce2..3f2fd656a2 100644 --- a/xbmc/pvr/channels/PVRChannelGroup.cpp +++ b/xbmc/pvr/channels/PVRChannelGroup.cpp @@ -31,7 +31,6 @@ #include "settings/lib/Setting.h" #include "settings/Settings.h" #include "threads/SingleLock.h" -#include "utils/JobManager.h" #include "utils/log.h" #include "utils/StringUtils.h" @@ -266,37 +265,26 @@ bool CPVRChannelGroup::MoveChannel(unsigned int iOldChannelNumber, unsigned int void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */) { - // searching and setting channel icons may take some time, and (more important) - // it triggers GUI which might lead to deadlocks if directly called. - PVR_CHANNEL_GROUP_MEMBERS groupMembers; - { - CSingleLock lock(m_critSection); - groupMembers = m_members; - } - - CJobManager::GetInstance().AddJob(new CPVRSearchAndSetChannelIcons(groupMembers, bUpdateDb), nullptr); -} - -bool CPVRSearchAndSetChannelIcons::DoWork() -{ std::string iconPath = CSettings::GetInstance().GetString(CSettings::SETTING_PVRMENU_ICONPATH); if (iconPath.empty()) - return true; + return; const CPVRDatabasePtr database(g_PVRManager.GetTVDatabase()); if (!database) - return false; + return; /* fetch files in icon path for fast lookup */ CFileItemList fileItemList; XFILE::CDirectory::GetDirectory(iconPath, fileItemList, ".jpg|.png|.tbn"); if (fileItemList.IsEmpty()) - return true; + return; CGUIDialogExtendedProgressBar* dlgProgress = (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS); CGUIDialogProgressBarHandle* dlgProgressHandle = dlgProgress ? dlgProgress->GetHandle(g_localizeStrings.Get(19287)) : NULL; + CSingleLock lock(m_critSection); + /* create a map for fast lookup of normalized file base name */ std::map<std::string, std::string> fileItemMap; const VECFILEITEMS &items = fileItemList.GetList(); @@ -310,14 +298,14 @@ bool CPVRSearchAndSetChannelIcons::DoWork() int channelIndex = 0; CPVRChannelPtr channel; - for(const auto &groupMember : m_groupMembers) + for(PVR_CHANNEL_GROUP_MEMBERS::const_iterator it = m_members.begin(); it != m_members.end(); ++it) { - channel = groupMember.second.channel; + channel = it->second.channel; /* update progress dialog */ if (dlgProgressHandle) { - dlgProgressHandle->SetProgress(channelIndex++, m_groupMembers.size()); + dlgProgressHandle->SetProgress(channelIndex++, m_members.size()); dlgProgressHandle->SetText(channel->ChannelName()); } @@ -342,7 +330,7 @@ bool CPVRSearchAndSetChannelIcons::DoWork() channel->SetIconPath(itItem->second, g_advancedSettings.m_bPVRAutoScanIconsUserSet); } - if (m_bUpdateDb) + if (bUpdateDb) channel->Persist(); //! @todo start channel icon scraper here if nothing was found @@ -350,8 +338,6 @@ bool CPVRSearchAndSetChannelIcons::DoWork() if (dlgProgressHandle) dlgProgressHandle->MarkFinished(); - - return true; } /********** sort methods **********/ diff --git a/xbmc/pvr/channels/PVRChannelGroup.h b/xbmc/pvr/channels/PVRChannelGroup.h index 90b9ef5291..dd2ede596a 100644 --- a/xbmc/pvr/channels/PVRChannelGroup.h +++ b/xbmc/pvr/channels/PVRChannelGroup.h @@ -546,18 +546,4 @@ namespace PVR private: CPVRChannelGroupPtr m_group; }; - - class CPVRSearchAndSetChannelIcons : public CJob - { - public: - CPVRSearchAndSetChannelIcons(const PVR_CHANNEL_GROUP_MEMBERS &groupMembers, bool bUpdateDb) - : m_groupMembers(groupMembers), m_bUpdateDb(bUpdateDb) {} - virtual ~CPVRSearchAndSetChannelIcons() {} - virtual const char *GetType() const { return "pvr-channelgroup-searchandsetchannelicons"; } - - virtual bool DoWork(); - private: - PVR_CHANNEL_GROUP_MEMBERS m_groupMembers; - const bool m_bUpdateDb; - }; } |