sw/source/filter/html/swhtml.cxx | 15 ++++++++------- sw/source/filter/html/swhtml.hxx | 6 ++++++ sw/source/filter/inc/fltshell.hxx | 24 ++++++++++++++++++++++++ sw/source/filter/ww8/ww8par.cxx | 18 +----------------- sw/source/filter/ww8/ww8par.hxx | 10 ---------- vcl/source/app/salusereventlist.cxx | 1 - 6 files changed, 39 insertions(+), 35 deletions(-)
New commits: commit 810b5f6491850d70bfe2da1f58927a3404d37d49 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Dec 11 15:20:17 2017 +0000 reuse ImportProgress class for exception safety cause if no EndProgress is called then the shell leaks so the document leaks, etc Change-Id: I8e22644e58ac440dbee60c2ceacda4abb002c81c Reviewed-on: https://gerrit.libreoffice.org/46246 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 1d865e761e59..e0740fa50b51 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -537,8 +537,9 @@ SvParserState SwHTMLParser::CallParser() { rInput.Seek(STREAM_SEEK_TO_END); rInput.ResetError(); - ::StartProgress( STR_STATSTR_W4WREAD, 0, rInput.Tell(), - m_xDoc->GetDocShell() ); + + m_xProgress.reset(new ImportProgress(m_xDoc->GetDocShell(), 0, rInput.Tell())); + rInput.Seek(STREAM_SEEK_TO_BEGIN); rInput.ResetError(); } @@ -619,7 +620,7 @@ void SwHTMLParser::Continue( HtmlTokenId nToken ) } // disable progress bar again - EndProgress( m_xDoc->GetDocShell() ); + m_xProgress.reset(); bool bLFStripped = false; if( SvParserState::Pending != GetStatus() ) @@ -1414,8 +1415,8 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken ) SetTextCollAttrs(); } // progress bar - if( !GetMedium() || !GetMedium()->IsRemote() ) - ::SetProgressState( rInput.Tell(), m_xDoc->GetDocShell() ); + if (m_xProgress) + m_xProgress->Update(rInput.Tell()); } break; @@ -2498,9 +2499,9 @@ void SwHTMLParser::ShowStatline() OSL_ENSURE( SvParserState::Working==eState, "ShowStatLine not in working state - That can go wrong" ); // scroll bar - if( !GetMedium() || !GetMedium()->IsRemote() ) + if (m_xProgress) { - ::SetProgressState( rInput.Tell(), m_xDoc->GetDocShell() ); + m_xProgress->Update(rInput.Tell()); CheckActionViewShell(); } else diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 799d856b4577..c02309b7e4c0 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -26,6 +26,7 @@ #include <svtools/htmltokn.h> #include <editeng/svxenum.hxx> #include <rtl/ref.hxx> +#include <fltshell.hxx> #include <fmtornt.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/form/XFormComponent.hpp> @@ -363,6 +364,11 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient friend class CellSaveStruct; friend class CaptionSaveStruct; + /* + Progress bar + */ + std::unique_ptr<ImportProgress> m_xProgress; + OUString m_aPathToFile; OUString m_sBaseURL; OUString m_aBasicLib; diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index bc8fb87bf806..e1a8503d657d 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -25,8 +25,10 @@ #include <editeng/formatbreakitem.hxx> #include <poolfmt.hxx> #include <fmtornt.hxx> +#include <mdiexp.hxx> #include <ndindex.hxx> #include <pam.hxx> +#include <strings.hrc> #include <IDocumentRedlineAccess.hxx> #include <cstddef> @@ -319,6 +321,28 @@ public: SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset); +class ImportProgress +{ +private: + SwDocShell *m_pDocShell; +public: + ImportProgress(SwDocShell *pDocShell, long nStartVal, long nEndVal) + : m_pDocShell(pDocShell) + { + ::StartProgress(STR_STATSTR_W4WREAD, nStartVal, nEndVal, m_pDocShell); + } + + void Update(sal_uInt16 nProgress) + { + ::SetProgressState(nProgress, m_pDocShell); // Update + } + + ~ImportProgress() + { + ::EndProgress(m_pDocShell); + } +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 696826550e3d..db82bf84f21c 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4902,22 +4902,6 @@ void SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom, } } -ImportProgress::ImportProgress(SwDocShell *pDocShell) - : m_pDocShell(pDocShell) -{ - ::StartProgress(STR_STATSTR_W4WREAD, 0, 100, m_pDocShell); -} - -void ImportProgress::Update(sal_uInt16 nProgress) -{ - ::SetProgressState(nProgress, m_pDocShell); // Update -} - -ImportProgress::~ImportProgress() -{ - ::EndProgress(m_pDocShell); -} - ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss) { m_rDoc.SetDocumentType( SwDoc::DOCTYPE_MSWORD ); @@ -5006,7 +4990,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss) if (!m_bNewDoc) aSttNdIdx = m_pPaM->GetPoint()->nNode; - m_xProgress.reset(new ImportProgress(m_pDocShell)); + m_xProgress.reset(new ImportProgress(m_pDocShell, 0, 100)); // read Font Table m_xFonts.reset(new WW8Fonts(*m_pTableStream, *m_xWwFib)); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 32cdc79aa96c..57a6b4c5355c 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1052,16 +1052,6 @@ struct WW8TabBandDesc typedef std::set<WW8_CP> cp_set; typedef std::vector<WW8_CP> cp_vector; -class ImportProgress -{ -private: - SwDocShell *m_pDocShell; -public: - ImportProgress(SwDocShell *pDocShell); - void Update(sal_uInt16 nProgress); - ~ImportProgress(); -}; - class SwWW8ImplReader { private: commit ad35cc9ed0faa6555bc09e5e065abb5cdc6c4ee6 Author: Henry Castro <hcas...@collabora.com> Date: Sun Dec 10 21:11:35 2017 -0400 lok: Assertion `m_aProcessingUserEvents.empty()' failed This occurs after saving a writer document loolforkit: /home/hcastro/projects/lo-sid/vcl/source/app/salusereventlist.cxx:56: bool SalUserEventList::DispatchUserEvents(bool): Assertion `m_aProcessingUserEvents.empty()' failed. /home/hcastro/build/gcc-lool-sid/loolforkit(_ZN7SigUtil13dumpBacktraceEv+0x49) [0x55ba3f0740c6] /home/hcastro/build/gcc-lool-sid/loolforkit(+0x149fb1) [0x55ba3f073fb1] /lib/x86_64-linux-gnu/libpthread.so.0(+0x110c0) [0x7f57a41350c0] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcf) [0x7f57a3db7fcf] /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f57a3db93fa] /lib/x86_64-linux-gnu/libc.so.6(+0x2be37) [0x7f57a3db0e37] /lib/x86_64-linux-gnu/libc.so.6(+0x2bee2) [0x7f57a3db0ee2] /home/hcastro/build/gcc-lo-sid/instdir/program/libvcllo.so(_ZN16SalUserEventList18DispatchUserEventsEb+0x86) [0x7f5798f2178c] /home/hcastro/build/gcc-lo-sid/instdir/program/libvcllo.so(_ZN14SvpSalInstance7DoYieldEbb+0x3b) [0x7f57990ce48d] /home/hcastro/build/gcc-lo-sid/instdir/program/libvcllo.so(+0xa7b2fd) [0x7f5798f5b2fd] /home/hcastro/build/gcc-lo-sid/instdir/program/libvcllo.so(_ZN11Application5YieldEv+0x13) [0x7f5798f5735b] /home/hcastro/build/gcc-lo-sid/instdir/program/libvcllo.so(_ZN11Application7ExecuteEv+0x167) [0x7f5798f56f11] /home/hcastro/build/gcc-lo-sid/instdir/program/libsofficeapp.so(+0x4e419) [0x7f57a30d3419] /home/hcastro/build/gcc-lo-sid/instdir/program/libvcllo.so(+0xa87119) [0x7f5798f67119] /home/hcastro/build/gcc-lo-sid/instdir/program/libvcllo.so(_Z6SVMainv+0x4d) [0x7f5798f67282] /home/hcastro/build/gcc-lo-sid/instdir/program/libsofficeapp.so(soffice_main+0x1bf) [0x7f57a312a6b5] /home/hcastro/build/gcc-lo-sid/instdir/program/libsofficeapp.so(+0xe8db2) [0x7f57a316ddb2] /home/hcastro/build/gcc-lo-sid/instdir/program/libuno_sal.so.3(+0x77581) [0x7f579f807581] /lib/x86_64-linux-gnu/libpthread.so.0(+0x7494) [0x7f57a412b494] /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f57a3e6daff] Change-Id: I455bd44d40c6c9b3ed49d047b8bce23a4600c265 Reviewed-on: https://gerrit.libreoffice.org/46206 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Henry Castro <hcas...@collabora.com> diff --git a/vcl/source/app/salusereventlist.cxx b/vcl/source/app/salusereventlist.cxx index a3b77ecc2c19..2dfc84cc230c 100644 --- a/vcl/source/app/salusereventlist.cxx +++ b/vcl/source/app/salusereventlist.cxx @@ -53,7 +53,6 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents ) { osl::MutexGuard aGuard( m_aUserEventsMutex ); - assert( m_aProcessingUserEvents.empty() ); if( ! m_aUserEvents.empty() ) { if( bHandleAllCurrentEvents )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits