[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jun 10 12:00:46 PDT 2011


 sc/source/core/tool/interpr4.cxx |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 933a945c6c065d7a1897451bde57035d8597f580
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Jun 10 14:32:26 2011 -0400

    Prevent a crash during multiple operations.

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 4813b84..68d07d1 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3391,6 +3391,20 @@ sal_Bool ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos
     return bOk;
 }
 
+namespace {
+
+class FindByPointer : ::std::unary_function<ScInterpreterTableOpParams, bool>
+{
+    const ScInterpreterTableOpParams* mpTableOp;
+public:
+    FindByPointer(const ScInterpreterTableOpParams* p) : mpTableOp(p) {}
+    bool operator() (const ScInterpreterTableOpParams& val) const
+    {
+        return &val == mpTableOp;
+    }
+};
+
+}
 
 void ScInterpreter::ScTableOp()
 {
@@ -3450,7 +3464,11 @@ void ScInterpreter::ScTableOp()
         PushString( aCellString );
     }
 
-    pTableOp = pDok->aTableOpList.release( pDok->aTableOpList.end() ).release();
+    boost::ptr_vector< ScInterpreterTableOpParams >::iterator itr =
+        ::std::find_if(pDok->aTableOpList.begin(), pDok->aTableOpList.end(), FindByPointer(pTableOp));
+    if (itr != pDok->aTableOpList.end())
+        pTableOp = pDok->aTableOpList.release(itr).release();
+
     // set dirty again once more to be able to recalculate original
     for ( ::std::vector< ScFormulaCell* >::const_iterator iBroadcast(
                 pTableOp->aNotifiedFormulaCells.begin() );


More information about the Libreoffice-commits mailing list