[Libreoffice-commits] core.git: svx/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 18 16:25:07 UTC 2021


 svx/source/svdraw/svdetc.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 0e88b550d79ea3346b08fe8e8276b7615d67c213
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Aug 18 16:29:21 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Aug 18 18:24:29 2021 +0200

    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 at collabora.com>

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& )
         {}


More information about the Libreoffice-commits mailing list