Monteverdi segfaults using contextual menu on module item
Mantis Issue 412, reported by cvalladeau, assigned to cvalladeau, created: 2011-09-13
Monteverdi segfault using contextual menu on module item
1316017864 - C ValladeauFixed here : http://hg.orfeo-toolbox.org/Monteverdi/rev/b14e4ea4e136 The reason is not well understand, should be trouble with vector ieraot when the vector template is itkSmartPointer (GetPointer() returned 0x0)...
1316018358 - julienmthe reason is because GetModuleMap returns a copy and not a reference.
call it two times, and you get two different ModuleMap
it contains smart pointers, that's why the current code works.
1316019060 - C ValladeauI totaly agree but that doesn't explain all. Why the pointer of the SmartPointer is not null at each copy?
To be clear, I've tested that :
ModuleMapType::const_iterator mcIt = m_MonteverdiModel->GetModuleMap().begin(); (*mcIt)->GetInstanceId() => segfault
and
m_MonteverdiModel->GetModuleMap().begin()->GetInstanceId() => OK
and bis
ModuleMapType modMap = m_MonteverdiModel->GetModuleMap(); ModuleMapType::const_iterator mcIt = modMap.begin(); (*mcIt)->GetInstanceId() => OK
In each case, the copy construct