| View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0010374 | VTK | (No Category) | public | 2010-03-05 06:53 | 2013-04-05 20:14 | ||||
| Reporter | Gianluca | ||||||||
| Assigned To | David Cole | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||
| Status | closed | Resolution | fixed | ||||||
| Platform | OS | OS Version | |||||||
| Product Version | |||||||||
| Target Version | Fixed in Version | ||||||||
| Summary | 0010374: vtkSeedRepresentation crash | ||||||||
| Description | I have compiled the latest version of VTK (from CVS) and the WidgetsCxxTests.exe (debug mode) crashs when you run Test15 (vtkSeedWidget). The error reported is: "list iterator not dereferencable" and the debugger show the line: ( *iter )->Delete(); The problem is in the following methods of the file vtkSeedRepresentation.cxx: /---------------------------------------------------------------------- void vtkSeedRepresentation::RemoveHandle( int n ) { // Remove nth handle if (n == this->ActiveHandle) { this->RemoveActiveHandle(); return; } if (static_cast<int>(this->Handles->size()) <= n ) { return; } vtkHandleListIterator iter = this->Handles->begin(); vtkstd::advance( iter, n ); this->Handles->erase( iter ); ( *iter )->Delete(); } //---------------------------------------------------------------------- void vtkSeedRepresentation::RemoveActiveHandle() { if ( this->Handles->size() < 1 ) { return; } if ( this->ActiveHandle >= 0 && this->ActiveHandle < static_cast<int>(this->Handles->size()) ) { vtkHandleListIterator iter = this->Handles->begin(); vtkstd::advance( iter, this->ActiveHandle ); this->Handles->erase( iter ); ( *iter )->Delete(); this->ActiveHandle = -1; } Basically the error are in the following lines: this->Handles->erase( iter ); ( *iter )->Delete(); You have to FIRST delete the object and THEN remove the handle! That is you have to swap the two lines: ( *iter )->Delete(); this->Handles->erase( iter ); Now the example no longer crash (and my application too!) | ||||||||
| Tags | No tags attached. | ||||||||
| Project | |||||||||
| Type | |||||||||
| Attached Files | |||||||||
| Relationships | |
| Relationships |
| Notes | |
|
(0019900) David Cole (developer) 2010-03-16 15:08 |
vtkSeedRepresentation.cxx revision 1.14 date: 2010-03-09 17:32:06 -0500; author: david.cole; state: Exp; lines: +4 -3; commitid: XOkpjztk2U54Ijqu; BUG: Fix crash. NEVER, and I really do mean NEVER, dereference an STL iterator after calling erase. |
|
(0019984) David Cole (developer) 2010-03-23 09:11 |
cvs commit -m "BUG: Fix issue 0010374 - no, really, NEVER. (Thanks, John Drescher, on the VTK mailing list, for pointing this out.)" /cvsroot/VTK/VTK/Widgets/vtkSeedRepresentation.cxx,v <-- vtkSeedRepresentation.cxx new revision: 1.15; previous revision: 1.14 The way it went: - I fixed some failing tests / crashes occurring on VTK dashboard runs. - Francois pointed me to this bug, saying: hey take care of this. - I naively thought I had taken care of it already, so marked it as resolved. - John pointed out that there were two instances of the bad "erase" call in the code and that I had only fixed one of them. - I reopened the bug, fixed the other one, and am now re-resolving it. - Hopefully it's really done now! |
| Notes |
| Issue History | |||
| Date Modified | Username | Field | Change |
| 2010-03-05 06:53 | Gianluca | New Issue | |
| 2010-03-16 15:08 | David Cole | Status | backlog => tabled |
| 2010-03-16 15:08 | David Cole | Assigned To | => David Cole |
| 2010-03-16 15:08 | David Cole | Status | tabled => @80@ |
| 2010-03-16 15:08 | David Cole | Resolution | open => fixed |
| 2010-03-16 15:08 | David Cole | Status | @80@ => @20@ |
| 2010-03-16 15:08 | David Cole | Resolution | fixed => reopened |
| 2010-03-16 15:08 | David Cole | Note Added: 0019900 | |
| 2010-03-16 15:08 | David Cole | Status | @20@ => @80@ |
| 2010-03-16 15:08 | David Cole | Resolution | reopened => fixed |
| 2010-03-23 09:08 | David Cole | Status | @80@ => @20@ |
| 2010-03-23 09:08 | David Cole | Resolution | fixed => reopened |
| 2010-03-23 09:11 | David Cole | Note Added: 0019984 | |
| 2010-03-23 09:11 | David Cole | Status | @20@ => @80@ |
| 2010-03-23 09:11 | David Cole | Resolution | reopened => fixed |
| 2011-01-13 17:00 | Source_changeset_attached | => VTK master a2bd8391 | |
| 2011-01-13 17:00 | Source_changeset_attached | => VTK master 020ef709 | |
| 2011-06-16 13:11 | Zack Galbreath | Category | => (No Category) |
| 2013-04-05 20:14 | Berk Geveci | Status | customer review => closed |
| Issue History |
| Copyright © 2000 - 2018 MantisBT Team |