[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source

Tor Lillqvist tml at kemper.freedesktop.org
Fri Jun 10 13:14:10 PDT 2011


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

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

    Prevent a crash during multiple operations.
    
    Signed-off-by: Tor Lillqvist <tlillqvist at novell.com>

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index bfe5b6b..8de2e38 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3397,6 +3397,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()
 {
@@ -3456,7 +3470,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