vtkSeedWidget CRASH!!!
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The method DeleteSeed of the class vtkSeedWidget crash:
void vtkSeedWidget::DeleteSeed(int i) { if( this->Seeds->size() <= static_cast< size_t >(i) ) { return; }
vtkSeedRepresentation rep = static_cast<vtkSeedRepresentation>(this->WidgetRep); if (rep) { rep->RemoveHandle( i ); }
vtkSeedListIterator iter = this->Seeds->begin();
vtkstd::advance(iter,i);
(*iter)->SetEnabled(0);
(*iter)->RemoveObservers(vtkCommand::StartInteractionEvent);
(*iter)->RemoveObservers(vtkCommand::InteractionEvent);
(*iter)->RemoveObservers(vtkCommand::EndInteractionEvent);
vtkHandleWidget * w = (*iter);
this->Seeds->erase( iter );
w->Delete();
}
The problem is in the last two lines. You have to FIRST delete the object, then erase the relative iterator. That is you have to swap the last two lines:
w->Delete(); this->Seeds->erase( iter );
Please fix it! Thanks.
- AGPX