Commit e2601072 authored by Tusooa Zhu's avatar Tusooa Zhu 🔼

Fix flake tests under asan

ShapeGroupContainerModel::remove() will call KoShapeGroup::invalidateSizeCache(),
even when the shape group is going to be destroyed. This method is called after
KoShapeGroup's destructor, so at this time we no longer have access to members of
KoShapeGroup, i.e. its d-pointer. So this call will cause access violation as the
instance `QScopedPointer<Private> d` in KoShapeGroup has already been destroyed.

This is a result of getting rid of derived d-pointers, because if we use a derived
d-pointer, it only gets destroyed in the ancestor class (KoShape). We temporarily
fix this problem by manually call `model()->deleteOwnedShapes()` in KoShapeGroup's
destructor.
parent 67cc69ce
......@@ -116,6 +116,13 @@ KoShapeGroup::KoShapeGroup(const KoShapeGroup &rhs)
KoShapeGroup::~KoShapeGroup()
{
/**
* HACK alert: model will use KoShapeGroup::invalidateSizeCache(), which uses
* KoShapeGroup's d-pointer. We have to manually remove child shapes from the
* model in the destructor of KoShapeGroup as the instance d is no longer accessible
* since ~KoShapeGroup() is executed
*/
model()->deleteOwnedShapes();
}
KoShape *KoShapeGroup::cloneShape() const
......
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