Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
libreoffice.4078
bnc1014896.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc1014896.diff of Package libreoffice.4078
From 1cba69762fc0a2d586bcfdf0893a6177aa63dfc4 Mon Sep 17 00:00:00 2001 From: Miklos Vajna <vmiklos@collabora.co.uk> Date: Thu, 19 Jan 2017 11:11:43 +0100 Subject: [PATCH] tdf#105417 sw hyphenation: avoid infinite loop on zero-length last line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This hang happened when the user executed Tools -> Language -> Hyphenation -> Hyphenate All. This problem is visible only if all of these conditions are met: - a line in a paragraph has a word that already contains a soft-hyphen, but not at the position where the automatic hyphenation would insert it - the last line ends with a word that can be hyphenated - there is a fly frame in the document In this case it happens during hyphenation that the layout has an additional empty line at the end (which is removed by the time the layout finishes), so we hit the case when SwTextFormatter::Hyphenate() skips the "if( m_pCurr->PrtWidth() && m_pCurr->GetLen() )" block. Normally hyphenation terminates when it iterates over the portions of the line and no overrun nor any existing hyphen portion are seen, but in this case that never happened. Fix the problem by terminating not only when we reach the end of the portion iteration, but also when the portion list is non-existing (has zero length). (cherry picked from commit 1b6fa616087e7415be9dc7113bbd8bf381aadd70) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx Change-Id: I71d4b040a2d4692ae6eb92807dbbbb42b077a0f8 Reviewed-on: https://gerrit.libreoffice.org/33309 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> --- sw/qa/extras/uiwriter/data/tdf105417.odt | Bin 0 -> 9238 bytes sw/qa/extras/uiwriter/uiwriter.cxx | 27 +++++++++++++++++++++++++++ sw/source/core/text/txthyph.cxx | 5 +++++ sw/source/uibase/inc/hyp.hxx | 3 ++- sw/source/uibase/lingu/hyp.cxx | 2 +- 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 sw/qa/extras/uiwriter/data/tdf105417.odt diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index 369a22a..6b5bd84 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -197,6 +197,11 @@ bool SwTextFormatter::Hyphenate( SwInterHyphInfo &rHyphInf ) if( !pPos ) nWrdStart = 0; } + else + // In case the whole line is zero-length, that's the same situation as + // above when the portion iteration ends without explicitly breaking + // from the loop. + nWrdStart = 0; // Das alte LineLayout wird wieder eingestellt ... delete m_pCurr; diff --git a/sw/source/uibase/inc/hyp.hxx b/sw/source/uibase/inc/hyp.hxx index c8881ba..3656662 100644 --- a/sw/source/uibase/inc/hyp.hxx +++ b/sw/source/uibase/inc/hyp.hxx @@ -23,10 +23,11 @@ #include <tools/link.hxx> #include <editeng/splwrap.hxx> #include <com/sun/star/linguistic2/XHyphenator.hpp> +#include <swdllapi.h> class SwView; -class SwHyphWrapper : public SvxSpellWrapper { +class SW_DLLPUBLIC SwHyphWrapper : public SvxSpellWrapper { private: SwView* pView; sal_uInt16 nPageCount; // page count for progress view diff --git a/sw/source/uibase/lingu/hyp.cxx b/sw/source/uibase/lingu/hyp.cxx index dc2a33c..3ae1352 100644 --- a/sw/source/uibase/lingu/hyp.cxx +++ b/sw/source/uibase/lingu/hyp.cxx @@ -119,7 +119,7 @@ SwHyphWrapper::~SwHyphWrapper() { if( nPageCount ) ::EndProgress( pView->GetDocShell() ); - if( bInfoBox ) + if( bInfoBox && !Application::IsHeadlessModeEnabled() ) ScopedVclPtrInstance<InfoBox>(&pView->GetEditWin(), SW_RESSTR(STR_HYP_OK))->Execute(); } -- 2.6.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor