[REVIEW-3-6] [PUSHED 3-6] fix for fdo#52351, remove conditional formatting if all its cells are removed

Kohei Yoshida kohei.yoshida at gmail.com
Mon Aug 6 09:20:50 PDT 2012


On Mon, Aug 6, 2012 at 11:42 AM, Kohei Yoshida <kohei.yoshida at gmail.com> wrote:
> On Mon, Aug 6, 2012 at 11:21 AM, Stephan Bergmann <sbergman at redhat.com> 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


More information about the LibreOffice mailing list