Commit bc68cda4 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Don't leak shapes! The recursive crash is finally fixed.

parent b8aa7128
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <QPainterPath> #include <QPainterPath>
#include "kis_painting_tweaks.h" #include "kis_painting_tweaks.h"
#include "kis_assert.h"
KoShapeContainerPrivate::KoShapeContainerPrivate(KoShapeContainer *q) KoShapeContainerPrivate::KoShapeContainerPrivate(KoShapeContainer *q)
: KoShapePrivate(q), : KoShapePrivate(q),
...@@ -58,9 +59,14 @@ KoShapeContainer::~KoShapeContainer() ...@@ -58,9 +59,14 @@ KoShapeContainer::~KoShapeContainer()
{ {
Q_D(KoShapeContainer); Q_D(KoShapeContainer);
if (d->model) { if (d->model) {
Q_FOREACH (KoShape *shape, d->model->shapes()) { QList<KoShape*> ownedShapes = d->model->shapes();
Q_FOREACH (KoShape *shape, ownedShapes) {
shape->setParent(0);
delete shape; delete shape;
} }
KIS_SAFE_ASSERT_RECOVER_NOOP(!d->model->count());
} }
} }
......
...@@ -47,6 +47,11 @@ struct SvgTester ...@@ -47,6 +47,11 @@ struct SvgTester
} }
~SvgTester ()
{
qDeleteAll(shapes);
}
void run() { void run() {
shapes = parser.parseSvg(root, &fragmentSize); shapes = parser.parseSvg(root, &fragmentSize);
} }
......
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