[TD]Fix #4017 Crash on bad hatch scale

This commit is contained in:
wandererfan
2019-07-18 20:12:28 -04:00
committed by WandererFan
parent 82dd7f0344
commit 21efae348e
4 changed files with 34 additions and 7 deletions

View File

@@ -517,6 +517,7 @@ void QGIFace::buildSvgHatch()
before.append(QString::fromStdString(SVGCOLPREFIX + SVGCOLDEFAULT));
after.append(QString::fromStdString(SVGCOLPREFIX + m_svgCol));
QByteArray colorXML = m_svgXML.replace(before,after);
long int tileCount = 0;
for (int iw = 0; iw < int(nw); iw++) {
for (int ih = 0; ih < int(nh); ih++) {
QGCustomSvg* tile = new QGCustomSvg();
@@ -525,6 +526,14 @@ void QGIFace::buildSvgHatch()
tile->setParentItem(m_rect);
tile->setPos(iw*wTile,-h + ih*hTile);
}
tileCount++;
if (tileCount > m_maxTile) {
Base::Console().Warning("SVG tile count exceeded: %ld\n",tileCount);
break;
}
}
if (tileCount > m_maxTile) {
break;
}
}
}
@@ -611,6 +620,10 @@ void QGIFace::getParameters(void)
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
m_maxSeg = hGrp->GetInt("MaxSeg",10000l);
hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
m_maxTile = hGrp->GetInt("MaxSVGTile",10000l);
}