Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


I'd like to cherry-pick

http://cgit.freedesktop.org/libreoffice/calc/commit/?id=933a945c6c065d7a1897451bde57035d8597f580

to the -3-4 branch.  There is no bug report associated with this, but
Tor found this while running demo code for UNO C# binding.

This is also one of the unfortunate crashers resulted from the
DECLARE_LIST removal.  The original line as of 3.3 was

    pDok->aTableOpList.Remove( pTableOp );

which removes the element from the container (if exists), but the object
itself is not destroyed.  After the List was replaced with
boost::ptr_vector, the line changed to

pTableOp = pDok->aTableOpList.release( pDok->aTableOpList.end()
).release();

which almost nailed it, except that the end position iterator

  pDok->aTableOpList.end()

doesn't point to any element so what that line does is undefined and
apparently causes a crash on Windows at least.  I'm pretty sure that
back() was intended to be used instead of end() there.  But even then,
the original code doesn't make the assumption that pTableOp was always
the last element of the list.  So, the right thing to do here to
faithfully emulate the original code is to try to find pTableOp position
using std::find_if, followed by the release of that element from the
ptr_vector container using the iterator returned from the find_if call.

Kohei

P.S. BTW, Tor already gave me his sign-off on IRC and cherry-picked this
to the -3-4 branch while writing this mail, so no review is needed. ;-)

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida@novell.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.