Skip to content

Commit

Permalink
Fix memory leaks with LineItem
Browse files Browse the repository at this point in the history
  • Loading branch information
MinyazevR authored and iakov committed Oct 25, 2024
1 parent 255135e commit 0ce4d75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ StylusItem::StylusItem(qreal x1, qreal y1)
mTmpY1 = y1;
}

StylusItem::~StylusItem()
{
qDeleteAll(mAbstractListLine);
}

AbstractItem *StylusItem::clone() const
{
const auto cloned = new StylusItem(x1(), y1());
Expand Down Expand Up @@ -148,6 +153,7 @@ QDomElement StylusItem::serialize(QDomElement &parent) const
void StylusItem::deserialize(const QDomElement &element)
{
AbstractItem::deserialize(element);
qDeleteAll(mAbstractListLine);
mAbstractListLine.clear();
recalculateProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class StylusItem : public ColorFieldItem

public:
StylusItem(qreal x1, qreal y1);

~StylusItem() override;
AbstractItem *clone() const override;

/// Creates and returns colored stylus item for 2D model palette.
Expand Down

0 comments on commit 0ce4d75

Please sign in to comment.