QSharedPointer doesn't support deleting object from outside.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-02-15 16:43:12 +02:00
parent 18bbca7b9a
commit ca9bdbd3fb
2 changed files with 6 additions and 3 deletions

View File

@ -38,8 +38,7 @@ VisToolPin::VisToolPin(const VContainer *data, QGraphicsItem *parent)
this->mainColor = Qt::red; this->mainColor = Qt::red;
this->setZValue(2);// Show on top real tool this->setZValue(2);// Show on top real tool
m_point = QSharedPointer<VSimplePoint>(new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), m_point = new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), &factor);
&factor));
m_point->SetPointHighlight(true); m_point->SetPointHighlight(true);
m_point->setParentItem(this); m_point->setParentItem(this);
m_point->SetVisualizationMode(true); m_point->SetVisualizationMode(true);
@ -49,6 +48,10 @@ VisToolPin::VisToolPin(const VContainer *data, QGraphicsItem *parent)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VisToolPin::~VisToolPin() VisToolPin::~VisToolPin()
{ {
if (not m_point.isNull())
{
delete m_point;
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -45,7 +45,7 @@ public:
enum { Type = UserType + static_cast<int>(Vis::ToolPin)}; enum { Type = UserType + static_cast<int>(Vis::ToolPin)};
private: private:
Q_DISABLE_COPY(VisToolPin) Q_DISABLE_COPY(VisToolPin)
QSharedPointer<VSimplePoint> m_point; QPointer<VSimplePoint> m_point;
}; };
#endif // VISTOOLPIN_H #endif // VISTOOLPIN_H