aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorksooo <3226626+ksooo@users.noreply.github.com>2023-01-13 23:01:10 +0100
committerksooo <3226626+ksooo@users.noreply.github.com>2023-01-13 23:03:53 +0100
commitd181e9b5ba4ab8d5f83a5b5f05ac439ee10865fc (patch)
treec002fe060045983b64485c451796d880af14959d
parentd22384fb23c15f99b1b6982709fed621be96d71a (diff)
downloadxbmc-d181e9b5ba4ab8d5f83a5b5f05ac439ee10865fc.tar.xz
[listproviders] Used scoped lock in CDirectoryProvider::(UpdateURL|Reset).
-rw-r--r--xbmc/listproviders/DirectoryProvider.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp
index 836fd0ed8e..6a9395f09e 100644
--- a/xbmc/listproviders/DirectoryProvider.cpp
+++ b/xbmc/listproviders/DirectoryProvider.cpp
@@ -350,19 +350,20 @@ void CDirectoryProvider::OnFavouritesEvent(const CFavouritesService::FavouritesU
void CDirectoryProvider::Reset()
{
- std::unique_lock<CCriticalSection> lock(m_section);
- if (m_jobID)
- CServiceBroker::GetJobManager()->CancelJob(m_jobID);
- m_jobID = 0;
- m_items.clear();
- m_currentTarget.clear();
- m_currentUrl.clear();
- m_itemTypes.clear();
- m_currentSort.sortBy = SortByNone;
- m_currentSort.sortOrder = SortOrderAscending;
- m_currentLimit = 0;
- m_updateState = OK;
- lock.unlock();
+ {
+ std::unique_lock<CCriticalSection> lock(m_section);
+ if (m_jobID)
+ CServiceBroker::GetJobManager()->CancelJob(m_jobID);
+ m_jobID = 0;
+ m_items.clear();
+ m_currentTarget.clear();
+ m_currentUrl.clear();
+ m_itemTypes.clear();
+ m_currentSort.sortBy = SortByNone;
+ m_currentSort.sortOrder = SortOrderAscending;
+ m_currentLimit = 0;
+ m_updateState = OK;
+ }
std::unique_lock<CCriticalSection> subscriptionLock(m_subscriptionSection);
if (m_isSubscribed)
@@ -529,13 +530,14 @@ bool CDirectoryProvider::IsUpdating() const
bool CDirectoryProvider::UpdateURL()
{
- std::unique_lock<CCriticalSection> lock(m_section);
- std::string value(m_url.GetLabel(m_parentID, false));
- if (value == m_currentUrl)
- return false;
+ {
+ std::unique_lock<CCriticalSection> lock(m_section);
+ std::string value(m_url.GetLabel(m_parentID, false));
+ if (value == m_currentUrl)
+ return false;
- m_currentUrl = value;
- lock.unlock();
+ m_currentUrl = value;
+ }
std::unique_lock<CCriticalSection> subscriptionLock(m_subscriptionSection);
if (!m_isSubscribed)