diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-18 16:29:21 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-18 18:24:29 +0200 |
commit | 0e88b550d79ea3346b08fe8e8276b7615d67c213 (patch) | |
tree | 4611991dbba416024eaf6d1a4113c55d29863e1e | |
parent | 4dbe4a9313d9844c10f71b29a77218d31bc6f3b3 (diff) |
Do not forget to remove just unloaded object from the cache
It turns out that unloading objects does not necessarily remove it
from the cache automatically (e.g.,
SdrLightEmbeddedClient_Impl::stateChanged is not called with
respective change). In this case, the cache size grows, and it
attempts to clear more excessive objects at each append.
Remove the object explicitly after unloading to avoid it.
Change-Id: I392c8eb6ef8e3fe89f148366021f61b9c0428a9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120637
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | svx/source/svdraw/svdetc.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index 99003590e06b..471c0e65ffd9 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -152,8 +152,13 @@ IMPL_LINK_NOARG(OLEObjCache, UnloadCheckHdl, Timer*, void) } if ( bUnload && UnloadObj(pUnloadObj) ) + { // object was successfully unloaded - nCount2--; + RemoveObj(pUnloadObj); + nCount2 = std::min(nCount2 - 1, maObjs.size()); + if (nIndex >= nCount2) + nIndex = nCount2 - 1; + } } catch( uno::Exception& ) {} |