vcl/source/outdev/text.cxx | 4 ++++
1 file changed, 4 insertions(+)
New commits:
commit 304b3b3910bb472d663baaa789970df55ceeb09e
Author: Stephan Bergmann <[email protected]>
Date: Mon May 5 10:50:22 2014 +0200
Handle GetTextBreak returning -1
I don't know what the root cause is exactly that made at least Mac OS X
--enable-dbgutil JunitTest_forms_unoapi start to fail recently, but when
nWidth
is just 1 (which might be the root of the problem here, but could probably
also
legitimately be the case) and GetTextWidth returns -1 (which it probably is
allowed to do), this would lead to an out-of-bounds OUString::operator[]
access
at
> rtl::OUString::operator[] (this=0x118a04be0, index=-1) at ustring.hxx:421
> com::sun::star::i18n::BreakIterator_Unicode::getLineBreak
(this=0x11986f6f8, Text=@0x118a04be0, nStartPos=-2, rLocale=@0x7fbd83821d98,
nMinBreakPos=4, hOptions=@0x118a04620) at
i18npool/source/breakiterator/breakiterator_unicode.cxx:429
> com::sun::star::i18n::BreakIteratorImpl::getLineBreak (this=0x1112d5c98,
Text=@0x118a04be0, nStartPos=-1, rLocale=@0x7fbd83821d98, nMinBreakPos=4,
hOptions=@0x118a04620, bOptions=@0x118a045f8) at
i18npool/source/breakiterator/breakiteratorImpl.cxx:242
> OutputDevice::ImplGetTextLines (rLineInfo=@0x118a04bb0, nWidth=1,
rStr=@0x118a04be0, nStyle=12560, _rLayout=@0x118a04db8) at
vcl/source/outdev/text.cxx:527
> OutputDevice::ImplDrawText (this=0x7fbd8302d000,
rTargetDevice=@0x7fbd8302d000, rRect=@0x118a05058, rOrigStr=@0x118a04f70,
nStyle=12560, pVector=0x0, pDisplayText=0x0, _rLayout=@0x118a04db8) at
vcl/source/outdev/text.cxx:1500
> OutputDevice::DrawText (this=0x7fbd8302d000, rRect=@0x118a05058,
rOrigStr=@0x118a04f70, nStyle=12560, pVector=0x0, pDisplayText=0x0,
_pTextLayout=0x0) at vcl/source/outdev/text.cxx:1754
> sfx2::TitledDockingWindow::Paint (this=0x7fbd8302d000,
i_rArea=@0x118a051d0) at sfx2/source/dialog/titledockwin.cxx:218
Change-Id: I95c6027e86b9a608fe9eb05ffb83fb2316c175f2
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index bb9fbc1..af9eb1b 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -521,6 +521,10 @@ long OutputDevice::ImplGetTextLines(
ImplMultiTextLineInfo& rLineInfo,
{
const css::lang::Locale&
rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale());
sal_Int32 nSoftBreak = _rLayout.GetTextBreak( rStr,
nWidth, nPos, nBreakPos - nPos );
+ if (nSoftBreak == -1)
+ {
+ nSoftBreak = nPos;
+ }
DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" );
css::i18n::LineBreakHyphenationOptions aHyphOptions(
xHyph, css::uno::Sequence <css::beans::PropertyValue>(), 1 );
css::i18n::LineBreakUserOptions aUserOptions;
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits