File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -335,7 +335,7 @@ bool SurfaceContoursWidget::removePoint( const std::shared_ptr<VisualObject>& ob
335335 }
336336 surfacePointWidgetCache_.erase ( contour[pickedIndex]->getPickSphere ().get () );
337337 contour.erase ( contour.begin () + pickedIndex );
338- assert ( contour.size () > pickedIndex );
338+ assert ( contour.size () >= pickedIndex );
339339 activeIndex_ = pickedIndex;
340340 activeObject_ = obj;
341341 highlightLastPoint ( obj );
@@ -557,12 +557,19 @@ void SurfaceContoursWidget::clear( bool writeHistory )
557557 if ( params.writeHistory && writeHistory )
558558 AppendHistory<SurfaceContoursWidgetClearAction>( " Clear points" + params.historyNameSuffix , *this );
559559
560- while ( ! pickedPoints_. empty () )
560+ for ( auto & [obj, contour] : pickedPoints_ )
561561 {
562- auto obj = pickedPoints_.begin ()->first ;
563- pickedPoints_.erase ( pickedPoints_.begin () );
564- onPointRemove_ ( obj );
562+ for ( int pickedIndex = int ( contour.size () ) - 1 ; pickedIndex >= 0 ; --pickedIndex )
563+ {
564+ surfacePointWidgetCache_.erase ( contour[pickedIndex]->getPickSphere ().get () );
565+ contour.erase ( contour.begin () + pickedIndex );
566+ assert ( contour.size () >= pickedIndex );
567+ activeIndex_ = pickedIndex;
568+ activeObject_ = obj;
569+ onPointRemove_ ( obj );
570+ }
565571 }
572+ pickedPoints_.clear ();
566573 surfacePointWidgetCache_.clear ();
567574 surfaceConnectionHolders_.clear ();
568575 activeIndex_ = 0 ;
You can’t perform that action at this time.
0 commit comments