[PATCH] convert detdata.cxx in SC module to std::vector

Eike Rathke erack at redhat.com
Wed Feb 8 06:44:52 PST 2012


Hi Noel,

On Wednesday, 2012-02-08 13:05:42 +0200, Noel Grandin wrote:

> Attached path converts usage of SV_DECL_PTRARR_DEL in
> sc/inc/detdata.hxx and associated code to std::vector.

SV_DECL_PTRARR_DEL is one of those containers that take ownership of the
objects pointed to, as you noticed and introduced deleting elements and
DeleteAndDestroy() method, and as such it is a candidate for
boost::ptr_vector instead of std::vector which makes workarounds like
DeleteAndDestroy() unnecessary, erase()'ing an element will also delete
the object. Care has to be taken when adding elements, ptr_vector if an
element could not be added deletes the object, so a dangling pointer
might be left and could be accessed, and a further delete would be
attempted twice.

I'd appreciate if you could rework the patch to use boost::ptr_vector
instead.

Thanks
  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120208/b2e4636c/attachment.pgp>


More information about the LibreOffice mailing list