From 8155efc399f12bffbbab23a2efc67e172bf08e9c Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 20 Dec 2021 16:04:00 +0100 Subject: sw: fix SwTextGlyphsKey::operator==() It assumed that the length of our text and the RHS's text is the same, but that may not be true. Originally introduced in commit c7b83934fcf4120c1a4cba8e1eaf9c7aef9edc82 (tdf#119992 sw: compare sub-strings in SwTextGlyphsKey comparison, 2018-10-12). Change-Id: I0361ec001aaffdbad6814bbbfefec6eaeb367f10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127163 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 0aca74c0acc3e1c3f6099f47bfe9bfedfa7bf86d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127258 Reviewed-by: Michael Stahl --- sw/source/core/txtnode/fntcache.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index f2c18d7b1ce9..93e83c2013e9 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -91,7 +91,8 @@ bool SwTextGlyphsKey::operator==(SwTextGlyphsKey const & rhs) const { bool b = m_pOutputDevice.get() == rhs.m_pOutputDevice.get() && m_nIndex == rhs.m_nIndex - && m_nLength == rhs.m_nLength; + && m_nLength == rhs.m_nLength + && m_aText.getLength() == rhs.m_aText.getLength(); if (!b) return false; if(m_nLength >= 0 && m_nIndex >= 0 && m_nIndex + m_nLength <= m_aText.getLength()) -- cgit