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


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: pgpEWahobhdgZ.pgp
Description: PGP signature


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.