sc/source/core/inc/adiasync.hxx | 2 -- sc/source/core/tool/adiasync.cxx | 36 +++++++++++++----------------------- 2 files changed, 13 insertions(+), 25 deletions(-)
New commits: commit 3d97b2000979200db53f77db20e882e85c66c0b6 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Jun 29 21:15:40 2016 +0200 Simplify finding elements of theAddInAsyncTbl Change-Id: Id9a2d84e1efb86a89e620dca5cd35274979aa1b9 diff --git a/sc/source/core/inc/adiasync.hxx b/sc/source/core/inc/adiasync.hxx index 237470d..c8e5b71 100644 --- a/sc/source/core/inc/adiasync.hxx +++ b/sc/source/core/inc/adiasync.hxx @@ -50,8 +50,6 @@ public: // cTor only if ScAddInAsync::Get fails. // nIndex: Index from FunctionCollection ScAddInAsync(sal_uLong nHandle, LegacyFuncData* pFuncData, ScDocument* pDoc); - // default-cTor only for that single, global aSeekObj! - ScAddInAsync(); virtual ~ScAddInAsync(); static ScAddInAsync* Get( sal_uLong nHandle ); static void CallBack( sal_uLong nHandle, void* pData ); diff --git a/sc/source/core/tool/adiasync.cxx b/sc/source/core/tool/adiasync.cxx index 19179dd..06e22f1 100644 --- a/sc/source/core/tool/adiasync.cxx +++ b/sc/source/core/tool/adiasync.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <algorithm> + #include <sfx2/objsh.hxx> #include "adiasync.hxx" @@ -28,7 +32,6 @@ #include <osl/thread.h> ScAddInAsyncs theAddInAsyncTbl; -static ScAddInAsync aSeekObj; extern "C" { void CALLTYPE ScAddInAsyncCallBack( double& nHandle, void* pData ) @@ -37,16 +40,6 @@ void CALLTYPE ScAddInAsyncCallBack( double& nHandle, void* pData ) } } -ScAddInAsync::ScAddInAsync() : - SvtBroadcaster(), - pDocs( nullptr ), - mpFuncData( nullptr ), - nHandle( 0 ), - meType( ParamType::NONE ), - bValid( false ) -{ // nur fuer aSeekObj ! -} - ScAddInAsync::ScAddInAsync(sal_uLong nHandleP, LegacyFuncData* pFuncData, ScDocument* pDoc) : SvtBroadcaster(), pStr( nullptr ), @@ -62,25 +55,22 @@ ScAddInAsync::ScAddInAsync(sal_uLong nHandleP, LegacyFuncData* pFuncData, ScDocu ScAddInAsync::~ScAddInAsync() { - // aSeekObj does not have that, handle 0 does not exist otherwise - if ( nHandle ) - { - // in dTor because of theAddInAsyncTbl.DeleteAndDestroy in ScGlobal::Clear - mpFuncData->Unadvice( (double)nHandle ); - if ( meType == ParamType::PTR_STRING && pStr ) // include type comparison because of union - delete pStr; - delete pDocs; - } + // in dTor because of theAddInAsyncTbl.DeleteAndDestroy in ScGlobal::Clear + mpFuncData->Unadvice( (double)nHandle ); + if ( meType == ParamType::PTR_STRING && pStr ) // include type comparison because of union + delete pStr; + delete pDocs; } ScAddInAsync* ScAddInAsync::Get( sal_uLong nHandleP ) { ScAddInAsync* pRet = nullptr; - aSeekObj.nHandle = nHandleP; - ScAddInAsyncs::iterator it = theAddInAsyncTbl.find( &aSeekObj ); + ScAddInAsyncs::iterator it = std::find_if( + theAddInAsyncTbl.begin(), theAddInAsyncTbl.end(), + [nHandleP](ScAddInAsync const * el) + { return el->nHandle == nHandleP; }); if ( it != theAddInAsyncTbl.end() ) pRet = *it; - aSeekObj.nHandle = 0; return pRet; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits