[PATCH] convert SV*PTRARR stuff in SW module

Michael Stahl mstahl at redhat.com
Tue Apr 24 10:03:03 PDT 2012


On 24/04/12 08:56, Noel Grandin wrote:
> Hi
> 
> This series of patches converts various datastructures in the SW module 
> from SV*PTRARR to std::vector, std::set, and boost::ptr_set variously.

so the first patch, which Caolan already pushed, causes a segfault in
dbaccess_complex, because of a double free in
SwXTextView::removeSelectionChangeListener: the
boost::ptr_vector::erase() actually deletes the element.

it would of course be nice if the f..ine documentation would mention
that erase() will delete the element, but i can't find that fact
mentioned here:

http://www.boost.org/doc/libs/1_49_0/libs/ptr_container/doc/ptr_sequence_adapter.html

actually in this case putting a uno::Reference into boost::ptr_vector
looks kind of silly to me, a std::vector would be sufficient, which also
fixes the crash ...

... but then i remembered that there is actually a much better container
for the special purpose of storing UNO listeners, namely
::cppu::OInterfaceContainerHelper, and using that gets rid of a lot of
boilerplate here.

i'll review the rest of the patches soonish...



More information about the LibreOffice mailing list