[vtkusers] New crash bug! This time in vtkSeedWidget!

John Drescher drescherjm at gmail.com
Fri Mar 26 08:57:05 EDT 2010


On Fri, Mar 26, 2010 at 8:53 AM, John Drescher <drescherjm at gmail.com> wrote:
> On Fri, Mar 26, 2010 at 8:42 AM, AGPX <agpxnet at yahoo.it> wrote:
>> Hi guys'n'gals,
>>
>> 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
>>
> This is fixed in cvs.
>
http://public.kitware.com/Bug/view.php?id=10374

BTW, I believe vtk-5.6.0 is supposed to be released today so you may
not have to grab the cvs..

John



More information about the vtkusers mailing list