I did a debug build. And I had some stl debug symbols in my backtrace so it might be that perhaps the compiler won't optimize this out.<br><br>I attached the backtrace.<br><br>print it shows: it = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x29e3678, _M_version = 0, _M_prior = 0x0, _M_next = 0x0}, _M_current = {_M_current = 0x2a27bf0}}<br>
<br>and print maPersistTable:<br>$2 = {<std::__norm::vector<EscherPersistEntry*, std::allocator<EscherPersistEntry*> >> = {<std::__norm::_Vector_base<EscherPersistEntry*, std::allocator<EscherPersistEntry*> >> = {_M_impl = {<std::allocator<EscherPersistEntry*>> = <br>
{<__gnu_cxx::new_allocator<EscherPersistEntry*>> = {<No data fields>}, <No data fields>}, _M_start = 0x2a27bc8, _M_finish = 0x2a27bf0, _M_end_of_storage = <br> 0x2a27c08}}, <No data fields>}, <__gnu_debug::_Safe_sequence<std::__debug::vector<EscherPersistEntry*, std::allocator<EscherPersistEntry*> > >> = {<__gnu_debug::_Safe_sequence_base> = {_M_iterators = 0x7fff356e1120, <br>
_M_const_iterators = 0x0, _M_version = 5}, <No data fields>}, _M_guaranteed_capacity = 6}<br><br><br><div class="gmail_quote">2011/6/21 Noel Power <span dir="ltr"><<a href="mailto:nopower@novell.com" target="_blank">nopower@novell.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 21/06/11 15:17, Markus Mohrhard wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Noel, all,<br>
<br>
I have attached a test document and a diff. I don't understand why this still crashs calc even if there is nothing anymore that can create any problems.<br>
</blockquote></div>
well it doesn't crash for me ( even worse it doesn't crash without the patch either ) and even worse still valgrind doesn't even complain. Welll we know that erase invalidates vector iterators so I don't see a problem with your patch ( or doubt it's validity ) but still interested in reproducing at least this problem. Is there something else I need to do?<br>
<br>
Noel<br>
<br>
probably though I would just do the following rather than saving the iterator and doing the delete and erase outside the loop<br>
<br>
if ( (*it)->mnID == nID )<br>
<br>
{<br>
delete *it;<br>
maPersistTable.erase( it );<br>
break;<br>
}<br>
<br>
<br>
</blockquote></div><br>