[Libreoffice-commits] .: sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Jun 9 07:26:23 PDT 2011


 sw/source/core/doc/docbm.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit fa9ac16677f61261e2c9904672e7c03fa0254d7d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 9 15:25:49 2011 +0100

    fdo#37974 make recursive call of MarkManager::deleteMark do the right thing

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 939bbd8..d029881 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -719,6 +719,19 @@ namespace sw { namespace mark
         //position as const iterator ppMark was
         iterator_t aI = m_vMarks.begin();
         std::advance(aI, std::distance<const_iterator_t>(aI, ppMark));
+
+        //fdo#37974
+        //a) a mark destructor may callback into this method.
+        //b) vector::erase first calls the destructor of the object, then
+        //removes it from the vector.
+        //So if the only reference to the object is the one
+        //in the vector then we may reenter this method when the mark
+        //is destructed but before it is removed, i.e. findMark still
+        //finds the object whose destructor is being run. Take a temp
+        //extra reference on the shared_ptr, remove the entry from the
+        //vector, and on xHoldPastErase release findMark won't find
+        //it anymore.
+        pMark_t xHoldPastErase = *aI;
         m_vMarks.erase(aI);
     }
 


More information about the Libreoffice-commits mailing list