On Mon, Aug 6, 2012 at 11:42 AM, Kohei Yoshida <[email protected]> wrote: > On Mon, Aug 6, 2012 at 11:21 AM, Stephan Bergmann <[email protected]> wrote: >> 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). > > Ok then. I have no problem with it.
Pushed to 3-6 with mine and Stephan's (I hope you don't mind). Kohei _______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
