Commit 1575df7c authored by Tusooa Zhu's avatar Tusooa Zhu 🅱

Fix crash when moving shapes

We should use const qualifiers in KoPathShape::outline() to
avoid the container deep-copying the data since writing
data is not thread-safe.
parent f5f413b0
......@@ -468,10 +468,10 @@ QRectF KoPathShape::outlineRect() const
QPainterPath KoPathShape::outline() const
{
QPainterPath path;
Q_FOREACH (KoSubpath * subpath, d->subpaths) {
KoPathPoint * lastPoint = subpath->first();
Q_FOREACH (const KoSubpath * subpath, d->subpaths) {
const KoPathPoint * lastPoint = subpath->first();
bool activeCP = false;
Q_FOREACH (KoPathPoint * currPoint, *subpath) {
Q_FOREACH (const KoPathPoint * currPoint, *subpath) {
KoPathPoint::PointProperties currProperties = currPoint->properties();
if (currPoint == subpath->first()) {
if (currProperties & KoPathPoint::StartSubpath) {
......@@ -498,7 +498,7 @@ QPainterPath KoPathShape::outline() const
}
if (currProperties & KoPathPoint::CloseSubpath && currProperties & KoPathPoint::StopSubpath) {
// add curve when there is a curve on the way to the first point
KoPathPoint * firstPoint = subpath->first();
const KoPathPoint * firstPoint = subpath->first();
Q_ASSERT(!qIsNaNPoint(firstPoint->point()));
if (currPoint->activeControlPoint2() && firstPoint->activeControlPoint1()) {
path.cubicTo(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment