[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 17 07:25:40 UTC 2021
sc/source/ui/view/hintwin.cxx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
New commits:
commit b6e705ec690b9911ce44f3e6cb1273737449f186
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Mar 13 20:35:12 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Mar 17 08:25:05 2021 +0100
tdf#140986 hang in validity message
this doesn't fix the root of the problem (something generating an
insanely long validation message).
It just prevents that problem from locking up the UI.
Change-Id: I334729a30eca4a11d0150e3c89ff11c92a862061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112461
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
(cherry picked from commit 924733c65902d0b17764aded56c88c99d4b9a568)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112529
diff --git a/sc/source/ui/view/hintwin.cxx b/sc/source/ui/view/hintwin.cxx
index d690ab33d002..047b3be2dc3e 100644
--- a/sc/source/ui/view/hintwin.cxx
+++ b/sc/source/ui/view/hintwin.cxx
@@ -31,6 +31,7 @@
#include <vcl/outdev.hxx>
#include <vcl/settings.hxx>
#include <vcl/metric.hxx>
+#include <sal/log.hxx>
#define HINT_LINESPACE 2
#define HINT_INDENT 3
@@ -104,9 +105,16 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlaySequ
sal_Int32 nIndex = 0;
Point aLineStart = aTextStart;
+ sal_Int32 nLineCount = 0;
while (nIndex != -1)
{
OUString aLine = m_aMessage.getToken( 0, '\r', nIndex );
+ if (aLine.getLength() > 255)
+ {
+ // prevent silliness higher up from hanging up the program
+ SAL_WARN("sc", "ridiculously long line, truncating, len=" << aLine.getLength());
+ aLine = aLine.copy(0,255);
+ }
aTextMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix(
aFontSize.getX(), aFontSize.getY(),
@@ -125,6 +133,13 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlaySequ
aSeq.push_back(aMessage);
aLineStart.AdjustY(nLineHeight );
+ nLineCount++;
+ if (nLineCount > 50)
+ {
+ // prevent silliness higher up from hanging up the program
+ SAL_WARN("sc", "ridiculously long message, bailing out");
+ break;
+ }
}
rRange.expand(basegfx::B2DTuple(rRange.getMaxX() + aHintMargin.Width(),
More information about the Libreoffice-commits
mailing list