diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-06-10 14:32:26 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-06-10 15:00:38 -0400 |
commit | 933a945c6c065d7a1897451bde57035d8597f580 (patch) | |
tree | afcfa7cb2785c8333c494ed61a42e203af66f0d4 | |
parent | 13132183bef310e0553f2b42a69d7482e0bed1b3 (diff) |
Prevent a crash during multiple operations.
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 4813b844c..68d07d1a0 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() ); |