summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-04-29 17:14:42 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-05-13 19:51:05 +0200
commit103915a477ead1e6d0f799c57bf27050cae1abf4 (patch)
tree860842468ab38ca160e0edfd2ea1f75bb2965f24
parent63fd178941707bc6cf0bed91d2c21216e2747120 (diff)
tdf#122607 sw: remove deleted SwTextFrame's cache entry
Apparently nothing else would remove the entry, and without SwTextFrame it's not accessible any more. If the entry was recently used, then the SwSaveSetLRUOfst usage in SwViewShell::CalcLayout() will preserve it instead of giving the cache entry to a new frame. Change-Id: Id43fdbad2ac006853928e30a7b6768c3e3dc1667 Reviewed-on: https://gerrit.libreoffice.org/71541 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> (cherry picked from commit 31ae7509003b1e650463ee1468c0b315ba13efe6)
-rw-r--r--sw/source/core/bastyp/swcache.cxx9
-rw-r--r--sw/source/core/inc/swcache.hxx1
-rw-r--r--sw/source/core/text/txtfrm.cxx4
3 files changed, 14 insertions, 0 deletions
diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index 2019d7d0b3b5..ab82fe11ba74 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -326,6 +326,15 @@ void SwCache::DeleteObj( SwCacheObj *pObj )
CHECK;
}
+void SwCache::Delete(void const*const pOwner, sal_uInt16 const nIndex)
+{
+ INCREMENT( m_nDelete );
+ if (SwCacheObj *const pObj = Get(pOwner, nIndex, false))
+ {
+ DeleteObj(pObj);
+ }
+}
+
void SwCache::Delete( const void *pOwner )
{
INCREMENT( m_nDelete );
diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx
index 30410061b49f..a481bbff28ff 100644
--- a/sw/source/core/inc/swcache.hxx
+++ b/sw/source/core/inc/swcache.hxx
@@ -102,6 +102,7 @@ public:
void ToTop( SwCacheObj *pObj );
bool Insert( SwCacheObj *pNew );
+ void Delete(const void * pOwner, sal_uInt16 nIndex);
void Delete( const void *pOwner );
void SetLRUOfst( const sal_uInt16 nOfst ); /// nOfst determines how many are not to be touched
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 62b281ae6974..c759be22aa02 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -693,6 +693,10 @@ void SwTextFrame::DestroyImpl()
SwTextFrame::~SwTextFrame()
{
+ if (GetCacheIdx() != USHRT_MAX)
+ {
+ s_pTextCache->Delete(this, GetCacheIdx());
+ }
}
namespace sw {