From 2f122921e243533a053d3e40251384deb335d0fd Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 24 Aug 2016 15:14:33 +0300 Subject: [PATCH] Fix for '53219: Plot_2d Viewer' issue. --- src/Plot2d/Plot2d_ViewFrame.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 8f698be78..062e35493 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -1900,8 +1900,6 @@ void Plot2d_ViewFrame::updateAnalyticalCurve(Plot2d_AnalyticalCurve* c, bool upd case Plot2d_AnalyticalCurve::ActRemoveFromView: item->hide(); item->detach(); - myAnalyticalCurves.removeAll(c); - delete c; break; } @@ -1915,8 +1913,19 @@ void Plot2d_ViewFrame::updateAnalyticalCurve(Plot2d_AnalyticalCurve* c, bool upd void Plot2d_ViewFrame::updateAnalyticalCurves() { AnalyticalCurveList::iterator it = myAnalyticalCurves.begin(); + AnalyticalCurveList toDelete; for( ; it != myAnalyticalCurves.end(); it++) { - updateAnalyticalCurve(*it); + Plot2d_AnalyticalCurve* c = (*it); + updateAnalyticalCurve(c); + if(c && c->getAction() == Plot2d_AnalyticalCurve::ActRemoveFromView) + toDelete.push_back(c); + } + it = toDelete.begin(); + for( ; it != toDelete.end(); it++) { + Plot2d_AnalyticalCurve* c = (*it); + myAnalyticalCurves.removeAll(c); + delete c; + c = NULL; } myPlot->replot(); } @@ -1926,7 +1935,7 @@ void Plot2d_ViewFrame::updateAnalyticalCurves() */ AnalyticalCurveList Plot2d_ViewFrame::getAnalyticalCurves() const { - return myAnalyticalCurves; + return myAnalyticalCurves ; } /*! -- 2.39.2