summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2015-07-16 16:17:43 +0200
committerDavid Tardon <dtardon@redhat.com>2015-07-16 17:15:24 +0200
commit730f1e72686b9101c380d90bbbf521c1ec53c532 (patch)
treeeba6d1e503aa70311b8da455231cf9384ab7c161
parent17b71055939e80ea83506c633b908ca831bd0fad (diff)
avoid endless loop when reading broken file
Change-Id: I512d48b5ea25d3784f5b63725d4ff3b8ad648ccc
-rw-r--r--src/lib/VSDStylesCollector.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/VSDStylesCollector.cpp b/src/lib/VSDStylesCollector.cpp
index 4fc82f6..12e3643 100644
--- a/src/lib/VSDStylesCollector.cpp
+++ b/src/lib/VSDStylesCollector.cpp
@@ -402,8 +402,10 @@ void libvisio::VSDStylesCollector::endPage()
m_groupXFormsSequence.push_back(m_groupXForms);
m_groupMembershipsSequence.push_back(m_groupMemberships);
- while (!m_groupShapeOrder.empty())
+ bool changed = true;
+ while (!m_groupShapeOrder.empty() && changed)
{
+ changed = false;
for (std::list<unsigned>::iterator j = m_pageShapeOrder.begin(); j != m_pageShapeOrder.end();)
{
std::map<unsigned, std::list<unsigned> >::iterator iter = m_groupShapeOrder.find(*j++);
@@ -411,6 +413,7 @@ void libvisio::VSDStylesCollector::endPage()
{
m_pageShapeOrder.splice(j, iter->second, iter->second.begin(), iter->second.end());
m_groupShapeOrder.erase(iter);
+ changed = true;
}
}
}