[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 30 13:29:05 UTC 2019
sw/source/core/bastyp/swcache.cxx | 9 +++++++++
sw/source/core/inc/swcache.hxx | 1 +
sw/source/core/text/txtfrm.cxx | 4 ++++
3 files changed, 14 insertions(+)
New commits:
commit 31ae7509003b1e650463ee1468c0b315ba13efe6
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Apr 29 17:14:42 2019 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Apr 30 15:27:47 2019 +0200
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 at cib.de>
diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index 705c49accd79..ff6d568b8e83 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -323,6 +323,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 aa0e4188d608..9a6563e256ba 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 90541798c63f..37c1c406d365 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -881,6 +881,10 @@ void SwTextFrame::DestroyImpl()
SwTextFrame::~SwTextFrame()
{
+ if (GetCacheIdx() != USHRT_MAX)
+ {
+ s_pTextCache->Delete(this, GetCacheIdx());
+ }
}
namespace sw {
More information about the Libreoffice-commits
mailing list