From eade8b8fba0376b51405638d387d5517c0588acb Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 9 May 2012 17:31:43 +0400 Subject: [PATCH] gui/widget/hintboxext.cpp: fix invalid iterator advance Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1c89d21b4135bdd3f9ecf353cdb43d316109199f Author: [CST] Focus Date: 2012-05-09 (Wed, 09 May 2012) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/hintboxext.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/gui/widget/hintboxext.cpp b/src/gui/widget/hintboxext.cpp index 2f79d92d4..d00debe4d 100644 --- a/src/gui/widget/hintboxext.cpp +++ b/src/gui/widget/hintboxext.cpp @@ -258,26 +258,33 @@ void CHintBoxExt::refresh(bool toround) // it != m_startEntryOfPage.end();it++) { // printf(" %d",*it); // } -// printf("\n current page: %d",m_currentPage); -// printf("von %d bis %d\n",m_startEntryOfPage[m_currentPage],m_startEntryOfPage[m_currentPage+1]-1); + printf("\n current page: %d lines %d ",m_currentPage, m_lines.size()); + printf("start %d bis %d\n",m_startEntryOfPage[m_currentPage],m_startEntryOfPage[m_currentPage+1]-1); +#if 0 for (ContentLines::iterator it = m_lines.begin() + m_startEntryOfPage[m_currentPage]; it != m_lines.begin() + m_startEntryOfPage[m_currentPage+1] && it != m_lines.end(); ++it) +#endif + for (int count = 0; count < (int) m_lines.size(); count++) { - int xPos = textStartX; - int maxHeight = 0; - for (std::vector::iterator d = it->begin();d!=it->end();++d) + if ((count >= m_startEntryOfPage[m_currentPage]) && + (count < m_startEntryOfPage[m_currentPage+1])) { -// (*d)->print(); -// printf("\n"); - //(*d)->draw(m_window,xPos,yPos,m_width); - (*d)->draw(m_window,xPos,yPos,m_width-20); - xPos += (*d)->getWidth() + 20; - if ((*d)->getHeight() > maxHeight) - maxHeight = (*d)->getHeight(); + int xPos = textStartX; + int maxHeight = 0; + for (std::vector::iterator d = m_lines[count].begin(); d != m_lines[count].end(); ++d) + { + // (*d)->print(); + // printf("\n"); + //(*d)->draw(m_window,xPos,yPos,m_width); + (*d)->draw(m_window,xPos,yPos,m_width-20); + xPos += (*d)->getWidth() + 20; + if ((*d)->getHeight() > maxHeight) + maxHeight = (*d)->getHeight(); + } + yPos += maxHeight; } - yPos += maxHeight; } if (has_scrollbar())