Skip to content
Snippets Groups Projects
Commit 2ffc045b authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.formEditor: fixes memory leak

Also fixes the memory leak in resize code.
cleanup

Reviewed-by: Marco Bubke
parent b6bf93a2
No related branches found
No related tags found
No related merge requests found
...@@ -198,8 +198,6 @@ QPointF MoveManipulator::findSnappingOffset(const QHash<FormEditorItem*, QRectF> ...@@ -198,8 +198,6 @@ QPointF MoveManipulator::findSnappingOffset(const QHash<FormEditorItem*, QRectF>
void MoveManipulator::generateSnappingLines(const QHash<FormEditorItem*, QRectF> &boundingRectHash) void MoveManipulator::generateSnappingLines(const QHash<FormEditorItem*, QRectF> &boundingRectHash)
{ {
qDeleteAll(m_graphicsLineList);
m_graphicsLineList.clear();
m_graphicsLineList = m_snapper.generateSnappingLines(boundingRectHash.values(), m_graphicsLineList = m_snapper.generateSnappingLines(boundingRectHash.values(),
m_layerItem.data(), m_layerItem.data(),
m_snapper.transformtionSpaceFormEditorItem()->sceneTransform()); m_snapper.transformtionSpaceFormEditorItem()->sceneTransform());
...@@ -417,8 +415,10 @@ void MoveManipulator::setOpacityForAllElements(qreal opacity) ...@@ -417,8 +415,10 @@ void MoveManipulator::setOpacityForAllElements(qreal opacity)
void MoveManipulator::deleteSnapLines() void MoveManipulator::deleteSnapLines()
{ {
if (m_layerItem) { if (m_layerItem) {
foreach (QGraphicsItem *item, m_graphicsLineList) foreach (QGraphicsItem *item, m_graphicsLineList) {
m_layerItem->scene()->removeItem(item); m_layerItem->scene()->removeItem(item);
delete item;
}
} }
m_graphicsLineList.clear(); m_graphicsLineList.clear();
m_view->scene()->update(); m_view->scene()->update();
......
...@@ -474,8 +474,10 @@ bool ResizeManipulator::isInvalidSize(const QSizeF & size) ...@@ -474,8 +474,10 @@ bool ResizeManipulator::isInvalidSize(const QSizeF & size)
void ResizeManipulator::deleteSnapLines() void ResizeManipulator::deleteSnapLines()
{ {
if (m_layerItem) { if (m_layerItem) {
foreach (QGraphicsItem *item, m_graphicsLineList) foreach (QGraphicsItem *item, m_graphicsLineList) {
m_layerItem->scene()->removeItem(item); m_layerItem->scene()->removeItem(item);
delete item;
}
} }
m_graphicsLineList.clear(); m_graphicsLineList.clear();
......
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