From 67bd433e9d372146d136603be077ab1d144708aa Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Fri, 12 Jun 2020 18:03:14 +0200 Subject: [PATCH 1/2] [PVR] CGUIEPGGridContainer: Update layout early in GUI thread, not in timeline refresh thread, for performance and thread safety reasons (fix a race). --- xbmc/pvr/windows/GUIEPGGridContainer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xbmc/pvr/windows/GUIEPGGridContainer.cpp b/xbmc/pvr/windows/GUIEPGGridContainer.cpp index 432a695eeb51a..37313e9a85189 100644 --- a/xbmc/pvr/windows/GUIEPGGridContainer.cpp +++ b/xbmc/pvr/windows/GUIEPGGridContainer.cpp @@ -1593,6 +1593,8 @@ void CGUIEPGGridContainer::LoadLayout(TiXmlElement *layout) m_rulerLayouts.back().LoadLayout(itemElement, GetParentID(), false, m_width, m_height); itemElement = itemElement->NextSiblingElement("rulerlayout"); } + + UpdateLayout(); } std::string CGUIEPGGridContainer::GetDescription() const @@ -1715,7 +1717,6 @@ void CGUIEPGGridContainer::SetTimelineItems(const std::unique_ptr { CSingleLock lock(m_critSection); - UpdateLayout(); iRulerUnit = m_rulerUnit; iBlocksPerPage = m_blocksPerPage; fBlockSize = m_blockSize; From 723e603f8a42b236308107eabe19b179f134c586 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Fri, 12 Jun 2020 18:13:49 +0200 Subject: [PATCH 2/2] [PVR] Make CGUIEPGGridContainer::UpdateLayout thread-safe; some of the modified members will be read by timeline refresh thread. --- xbmc/pvr/windows/GUIEPGGridContainer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/pvr/windows/GUIEPGGridContainer.cpp b/xbmc/pvr/windows/GUIEPGGridContainer.cpp index 37313e9a85189..506c807d0c023 100644 --- a/xbmc/pvr/windows/GUIEPGGridContainer.cpp +++ b/xbmc/pvr/windows/GUIEPGGridContainer.cpp @@ -1795,6 +1795,8 @@ void CGUIEPGGridContainer::UpdateLayout() oldRulerLayout == m_rulerLayout && oldRulerDateLayout == m_rulerDateLayout) return; // nothing has changed, so don't update stuff + CSingleLock lock(m_critSection); + m_channelHeight = m_channelLayout->Size(VERTICAL); m_channelWidth = m_channelLayout->Size(HORIZONTAL);