Skip to content
Snippets Groups Projects
Commit 6e6db6f4 authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Steve Lhomme
Browse files

qt: fix double free in QSGRoundedRectangularImageNode

parent 119aaf89
No related branches found
No related tags found
1 merge request!3962qt: fix double free in QSGRoundedRectangularImageNode
Pipeline #369009 passed with stage
in 29 minutes and 16 seconds
......@@ -186,7 +186,8 @@ QSGGeometry* QSGRoundedRectangularImageNode::rebuildGeometry(const Shape& shape,
painterPath.addRoundedRect(0, 0, key.first.first, key.first.second, key.second, key.second);
painterPath = painterPath.simplified();
path = new QVector<QPointF>(painterPath.elementCount());
upPath = std::make_unique<QVector<QPointF>>(painterPath.elementCount());
path = upPath.get();
const int elementCount = painterPath.elementCount();
for (int i = 0; i < elementCount; ++i)
......@@ -203,8 +204,7 @@ QSGGeometry* QSGRoundedRectangularImageNode::rebuildGeometry(const Shape& shape,
: (elementCount - i - 1)));
}
if (!paths.insert(key, path))
upPath.reset(path); // Own the path so there is no leak
paths.insert(key, new QVector<QPointF>(*path));
}
vertexCount = path->count();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment