Hi Niklas,

On Monday, 2011-11-28 12:27:16 +0100, Niklas Johansson wrote:

> In worst case it makes the program crash. This fix, stores
> the values. I'm not that experienced with C++ so could someone have
> a second look at this there might very well be a "cleaner" way of
> writing it.

Good find!

I think I would do it slightly different, the patch fixes the symptom
correctly by allocating new objects, but the underlying cause to me
seems that the original intention was to transfer the pointers (hence
the method's name) but that somehow got mangled with the transition from
old List to ::std::vector


> --- a/basctl/source/basicide/bastypes.cxx
> +++ b/basctl/source/basicide/bastypes.cxx
> @@ -288,7 +288,7 @@ void BreakPointList::transfer(BreakPointList & rList)
>  {
>      reset();
>      for (size_t i = 0; i < rList.size(); ++i)
> -        maBreakPoints.push_back( rList.at( i ) );
> +        maBreakPoints.push_back( new BreakPoint(*rList.at( i )) );
>      rList.reset();
>  }

Instead of creating copies I'd do

-      rList.reset();
+      rList.clear();

Please check if that fixes the problem.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD

Attachment: pgpffxBcuhXLL.pgp
Description: PGP signature

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to