[Libreoffice-commits] core.git: embeddedobj/source sw/source
Mike Kaganski
mikekaganski at hotmail.com
Tue May 19 07:44:44 PDT 2015
embeddedobj/source/commonembedding/embedobj.cxx | 1 -
sw/source/core/ole/ndole.cxx | 6 ++----
2 files changed, 2 insertions(+), 5 deletions(-)
New commits:
commit b717bda1f6484905aebc571c4538165a1fbfd2bb
Author: Mike Kaganski <mikekaganski at hotmail.com>
Date: Mon May 18 00:03:41 2015 +1000
tdf#67421: Prevent unloading objects due to cache full
When an object is added to OLE objects cache, when cache is full,
old objects are tried to be unloaded. This triggers notifications
that cause all loaded objects to become active, and to be added to
cache (moved to front).
As the new object already was added to front of the cache, later
activity pushes it to back, until it is the last object in cache.
The cache in this process is overfilled, so each next refresh tries
to unload current last OLE object. So, in the end, this effectively
unloads all cached OLE objects.
This patch prevents this by first unloading last object, and then
adding new object to front of cache.
Also, removed needless creation of reference (makes at least 200
function calls for no reason).
Change-Id: Ia903f4df101971df1b0b0148320fc8e45ac1e79c
Reviewed-on: https://gerrit.libreoffice.org/15772
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 9e24276..4be6cc9 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -421,7 +421,6 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
uno::Exception,
uno::RuntimeException, std::exception )
{
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ), uno::UNO_QUERY);
{
::osl::ResettableMutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 649d0b7..d69ddd9 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -972,18 +972,16 @@ void SwOLELRUCache::InsertObj( SwOLEObj& rObj )
}
if (it == m_OleObjects.end())
{
- m_OleObjects.push_front( pObj );
-
// try to remove objects if necessary
- // (of course not the freshly inserted one at nPos=0)
sal_Int32 nCount = m_OleObjects.size();
sal_Int32 nPos = nCount-1;
- while (nPos && nCount > m_nLRU_InitSize)
+ while (nPos >= 0 && nCount >= m_nLRU_InitSize)
{
pObj = m_OleObjects[ nPos-- ];
if ( pObj->UnloadObject() )
nCount--;
}
+ m_OleObjects.push_front(&rObj);
}
}
More information about the Libreoffice-commits
mailing list