id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 11910,recursive_directory_iterator doesn't set end iterator properly when exception is thrown in increment(),David Raphael ,Beman Dawes,"in operations.hpp the increment function looks like this: {{{ void increment() { BOOST_ASSERT_MSG(m_imp.get(), ""increment of end recursive_directory_iterator""); m_imp->increment(0); if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator } }}} The problem occurs when you are incrementing using the ++ operator. If there is an exception, the stack is never checked to see if it is empty because the m_imp->increment() throws an exception. This leaves the recursive iterator in a bad state. I fixed it by doing this: {{{ void increment() { BOOST_ASSERT_MSG(m_imp.get(), ""increment of end recursive_directory_iterator""); try { m_imp->increment(0); } catch(filesystem_error e) { if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator throw(e); } if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator } }}} but I'm not sure that is the right way to address this issue. ",Bugs,new,To Be Determined,filesystem,Boost 1.60.0,Problem,,,