aboutsummaryrefslogtreecommitdiff
path: root/guilib
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2010-03-24 03:50:29 +0000
committerjmarshallnz <jmarshallnz@svn>2010-03-24 03:50:29 +0000
commit0a691f1eefbd7cf028f574a56d666c721f61fa01 (patch)
tree5a7df2846c4cf65d3556bbafe39a94ef4aaf9733 /guilib
parent5cb3e419d160f8bc61bc5de0f8cdbc4a4330482b (diff)
fixed: ensure m_scrollOffset is validated in *Container::ValidateOffset()
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@28783 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib')
-rw-r--r--guilib/GUIFixedListContainer.cpp4
-rw-r--r--guilib/GUIListContainer.cpp4
-rw-r--r--guilib/GUIPanelContainer.cpp4
3 files changed, 6 insertions, 6 deletions
diff --git a/guilib/GUIFixedListContainer.cpp b/guilib/GUIFixedListContainer.cpp
index d8076c917a..0d29b0baa5 100644
--- a/guilib/GUIFixedListContainer.cpp
+++ b/guilib/GUIFixedListContainer.cpp
@@ -156,12 +156,12 @@ void CGUIFixedListContainer::ValidateOffset()
m_cursor = std::max(m_cursor, minCursor);
m_cursor = std::min(m_cursor, maxCursor);
// and finally ensure our offset is valid
- if (m_offset + maxCursor >= (int)m_items.size())
+ if (m_offset + maxCursor >= (int)m_items.size() || m_scrollOffset > ((int)m_items.size() - maxCursor - 1) * m_layout->Size(m_orientation))
{
m_offset = m_items.size() - maxCursor - 1;
m_scrollOffset = m_offset * m_layout->Size(m_orientation);
}
- if (m_offset < -minCursor)
+ if (m_offset < -minCursor || m_scrollOffset < -minCursor * m_layout->Size(m_orientation))
{
m_offset = -minCursor;
m_scrollOffset = m_offset * m_layout->Size(m_orientation);
diff --git a/guilib/GUIListContainer.cpp b/guilib/GUIListContainer.cpp
index 7a9d9ddda8..a35a3b5ad3 100644
--- a/guilib/GUIListContainer.cpp
+++ b/guilib/GUIListContainer.cpp
@@ -198,12 +198,12 @@ void CGUIListContainer::Scroll(int amount)
void CGUIListContainer::ValidateOffset()
{ // first thing is we check the range of m_offset
if (!m_layout) return;
- if (m_offset > (int)m_items.size() - m_itemsPerPage)
+ if (m_offset > (int)m_items.size() - m_itemsPerPage || m_scrollOffset > ((int)m_items.size() - m_itemsPerPage) * m_layout->Size(m_orientation))
{
m_offset = m_items.size() - m_itemsPerPage;
m_scrollOffset = m_offset * m_layout->Size(m_orientation);
}
- if (m_offset < 0)
+ if (m_offset < 0 || m_scrollOffset < 0)
{
m_offset = 0;
m_scrollOffset = 0;
diff --git a/guilib/GUIPanelContainer.cpp b/guilib/GUIPanelContainer.cpp
index cd5bd88287..94d1c5ae6f 100644
--- a/guilib/GUIPanelContainer.cpp
+++ b/guilib/GUIPanelContainer.cpp
@@ -342,12 +342,12 @@ void CGUIPanelContainer::Scroll(int amount)
void CGUIPanelContainer::ValidateOffset()
{ // first thing is we check the range of m_offset
if (!m_layout) return;
- if (m_offset > (int)GetRows() - m_itemsPerPage)
+ if (m_offset > (int)GetRows() - m_itemsPerPage || m_scrollOffset > ((int)GetRows() - m_itemsPerPage) * m_layout->Size(m_orientation))
{
m_offset = (int)GetRows() - m_itemsPerPage;
m_scrollOffset = m_offset * m_layout->Size(m_orientation);
}
- if (m_offset < 0)
+ if (m_offset < 0 || m_scrollOffset < 0)
{
m_offset = 0;
m_scrollOffset = 0;