[PUSHED] Re: [PATCH] convert SV*PTRARR stuff in SW module

Michael Stahl mstahl at redhat.com
Wed Apr 25 03:52:50 PDT 2012

On 24/04/12 19:41, Noel Grandin wrote:
> On Tue, Apr 24, 2012 at 19:03, Michael Stahl <mstahl at redhat.com> wrote:
>> 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.
> Aaaargh. I should have known that. I keep getting tripped up with the
> weird semantics of SvPtrArr.
> As penance I checked all of my patches again, and 13 has the same
> Remove()->erase() problem, so I will resubmit that one later.

read your message too late, i have already fixed it, the code there is
rather weird but there is a ptr_vector::transfer function that can move
an element from one ptr_vector to another, which looks like the right
thing to do here.

other problems were:

patch 2 replaced the PTRARR_DEL _FndBoxes with a std::vector so it
introduced a memory leak; i have fixed that with another ptr_vector
(which required some changes because the operations return not pointers
but C++ references).

patch 12 had this:

> @@ -504,11 +501,11 @@ void SwNumRulesWithName::_SwNumFmtGlobal::Store( SvStream& rStream )
>      }
>      rStream << nCharPoolId;
>      rStream.WriteUniOrByteString( sCharFmtName, eEncoding );
> -    rStream << aItems.Count();
> +    rStream << aItems.size();

because size() returns a different sized integer than Count(), and the
streams have these moronic overloads that induce such errors, this
effectively changes the serialization format (and the Load method is not
adapted to match).
very likely this is unused code anyway, because AFAIK the only binary
serialization that is still used is in editeng (and its dependencies),
so i just inserted a cast there.

some patch forgot to adapt an assertion, probably would be best to do
such refactoring with OSL_DEBUG_LEVEL tuned up a bit (e.g.
--enable-debug or --enable-dbgutil if you have the disk space for it, or
just make dbglevel=3).

everything pushed now, thanks!

More information about the LibreOffice mailing list