On 08/06/2012 04:08 PM, Kohei Yoshida wrote:
Regarding

         iterator itr = begin();
         while(itr != end())
         {
             if(itr->GetRange().empty())
                 maConditionalFormats.erase(itr++);
             else
                 ++itr;
         }

that erase line causes an undefined behavior, and subtle, hard-to-find
bug later.  maConditionalFormats is a boost::ptr_set which uses
std::set in its implementation.  The std::set's erase call invalidates
the iterator of the element that has just been deleted, and that line
increments the iterator after it's been invalidated.

No, the line first increments itr, then calls erase (on the old itr value).

Stephan

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to