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 28, 2024
1 parent 255135e commit 2d31485
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
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
2 changes: 1 addition & 1 deletion qrtranslations/fr/plugins/robots/twoDModel_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
<context>
<name>twoDModel::items::StylusItem</name>
<message>
<location filename="../../../../plugins/robots/common/twoDModel/src/engine/items/stylusItem.cpp" line="+54"/>
<location filename="../../../../plugins/robots/common/twoDModel/src/engine/items/stylusItem.cpp" line="+59"/>
<source>Stylus (S)</source>
<translation>Stylo (S)</translation>
</message>
Expand Down
2 changes: 1 addition & 1 deletion qrtranslations/ru/plugins/robots/twoDModel_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@
<context>
<name>twoDModel::items::StylusItem</name>
<message>
<location filename="../../../../plugins/robots/common/twoDModel/src/engine/items/stylusItem.cpp" line="+54"/>
<location filename="../../../../plugins/robots/common/twoDModel/src/engine/items/stylusItem.cpp" line="+59"/>
<source>Stylus (S)</source>
<translation>Стилус (S)</translation>
</message>
Expand Down

0 comments on commit 2d31485

Please sign in to comment.