RepositoryExternal.mk | 9 ++++ config_host.mk.in | 1 config_host/config_qrcodegen.h.in | 17 ++++++++ configure.ac | 52 +++++++++++++++++--------- cui/source/dialogs/QrCodeGenDialog.cxx | 24 +++++++++--- distro-configs/LibreOfficeOssFuzz.conf | 1 external/qrcodegen/Module_qrcodegen.mk | 4 ++ include/svtools/filechangedchecker.hxx | 2 - lotuswordpro/source/filter/lwptablelayout.cxx | 14 +++---- lotuswordpro/source/filter/lwptablelayout.hxx | 2 - svtools/source/misc/filechangedchecker.cxx | 21 ++++++---- sw/qa/python/xtextfieldssupplier.py | 5 ++ vcl/source/font/fontcharmap.cxx | 32 ++++++++++++++-- 13 files changed, 139 insertions(+), 45 deletions(-)
New commits: commit 96a8c7b3ad21db406407a141eab1c52341273721 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Sep 21 17:02:31 2020 +0100 Commit: Andras Timar <[email protected]> CommitDate: Thu Sep 24 13:12:57 2020 +0200 add an explicit --disable-qrcodegen configure option Change-Id: If8e965fa955aecdb9e7011bdddc690de9cad0c4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103120 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103158 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 9c97d3af05f9..884bececcf08 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -4163,6 +4163,8 @@ gb_ExternalProject__use_qrcodegen := else # !SYSTEM_QRCODEGEN +ifneq ($(ENABLE_QRCODEGEN),) + define gb_LinkTarget__use_qrcodegen $(call gb_LinkTarget_use_unpacked,$(1),qrcodegen) $(call gb_LinkTarget_set_include,$(1),\ @@ -4180,6 +4182,13 @@ $(call gb_ExternalProject_use_static_libraries,$(1),qrcodegen) endef +else # !ENABLE_QRCODEGEN + +define gb_LinkTarget__use_qrcodegen +endef + +endif # ENABLE_QRCODEGEN + endif # SYSTEM_QRCODEGEN $(eval $(call gb_Helper_register_packages_for_install,ucrt_binarytable,\ diff --git a/config_host.mk.in b/config_host.mk.in index de1e44dc657b..95971e70ba99 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -464,6 +464,7 @@ export PYTHON_LIBS=$(gb_SPACE)@PYTHON_LIBS@ export PYTHON_VERSION=@PYTHON_VERSION@ export PYTHON_VERSION_MAJOR=@PYTHON_VERSION_MAJOR@ export PYTHON_VERSION_MINOR=@PYTHON_VERSION_MINOR@ +export ENABLE_QRCODEGEN=@ENABLE_QRCODEGEN@ export QRCODEGEN_CFLAGS=$(gb_SPACE)@QRCODEGEN_CFLAGS@ export QRCODEGEN_LIBS=$(gb_SPACE)@QRCODEGEN_LIBS@ export QT5_CFLAGS=$(gb_SPACE)@QT5_CFLAGS@ diff --git a/config_host/config_qrcodegen.h.in b/config_host/config_qrcodegen.h.in new file mode 100644 index 000000000000..63388651699f --- /dev/null +++ b/config_host/config_qrcodegen.h.in @@ -0,0 +1,17 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_CONFIG_QRCODEGEN_H +#define INCLUDED_CONFIG_QRCODEGEN_H + +#define ENABLE_QRCODEGEN 0 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configure.ac b/configure.ac index bc027616295d..bcf41f4ce668 100644 --- a/configure.ac +++ b/configure.ac @@ -1949,6 +1949,10 @@ AC_ARG_WITH(system-hunspell, [Use libhunspell already on system.]),, [with_system_hunspell="$with_system_libs"]) +libo_FUZZ_ARG_ENABLE(qrcodegen, + AS_HELP_STRING([--disable-qrcodegen], + [Disable use of qrcodegen external library.])) + AC_ARG_WITH(system-qrcodegen, AS_HELP_STRING([--with-system-qrcodegen], [Use libqrcodegen already on system.]),, @@ -10105,26 +10109,39 @@ AC_SUBST(HUNSPELL_LIBS) dnl =================================================================== dnl Check for system qrcodegen dnl =================================================================== -AC_MSG_CHECKING([which libqrcodegen to use]) -if test "$with_system_qrcodegen" = "yes"; then - AC_MSG_RESULT([external]) - SYSTEM_QRCODEGEN=TRUE - AC_LANG_PUSH([C++]) - AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [], - [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>]) - AC_CHECK_LIB([qrcodegencpp], [main], [:], - [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], []) - QRCODEGEN_LIBS=-lqrcodegencpp - AC_LANG_POP([C++]) - QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") - FilterLibs "${QRCODEGEN_LIBS}" - QRCODEGEN_LIBS="${filteredlibs}" -else - AC_MSG_RESULT([internal]) +AC_MSG_CHECKING([whether to use libqrcodegen]) +if test "$enable_libqrcodegen" = "no"; then + AC_MSG_RESULT([no]) + ENABLE_QRCODEGEN= SYSTEM_QRCODEGEN= - BUILD_TYPE="$BUILD_TYPE QRCODEGEN" +else + AC_MSG_RESULT([yes]) + ENABLE_QRCODEGEN=TRUE + AC_MSG_CHECKING([which libqrcodegen to use]) + if test "$with_system_qrcodegen" = "yes"; then + AC_MSG_RESULT([external]) + SYSTEM_QRCODEGEN=TRUE + AC_LANG_PUSH([C++]) + AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [], + [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>]) + AC_CHECK_LIB([qrcodegencpp], [main], [:], + [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], []) + QRCODEGEN_LIBS=-lqrcodegencpp + AC_LANG_POP([C++]) + QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") + FilterLibs "${QRCODEGEN_LIBS}" + QRCODEGEN_LIBS="${filteredlibs}" + else + AC_MSG_RESULT([internal]) + SYSTEM_QRCODEGEN= + BUILD_TYPE="$BUILD_TYPE QRCODEGEN" + fi + if test "$ENABLE_QRCODEGEN" = TRUE; then + AC_DEFINE(ENABLE_QRCODEGEN) + fi fi AC_SUBST(SYSTEM_QRCODEGEN) +AC_SUBST(ENABLE_QRCODEGEN) AC_SUBST(QRCODEGEN_CFLAGS) AC_SUBST(QRCODEGEN_LIBS) @@ -13001,6 +13018,7 @@ AC_CONFIG_HEADERS([config_host/config_mpl.h]) AC_CONFIG_HEADERS([config_host/config_oox.h]) AC_CONFIG_HEADERS([config_host/config_options.h]) AC_CONFIG_HEADERS([config_host/config_options_calc.h]) +AC_CONFIG_HEADERS([config_host/config_qrcodegen.h]) AC_CONFIG_HEADERS([config_host/config_typesizes.h]) AC_CONFIG_HEADERS([config_host/config_vendor.h]) AC_CONFIG_HEADERS([config_host/config_vcl.h]) diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx index d936219f7209..6277e767ae43 100644 --- a/cui/source/dialogs/QrCodeGenDialog.cxx +++ b/cui/source/dialogs/QrCodeGenDialog.cxx @@ -16,11 +16,15 @@ #include <vcl/weld.hxx> #include <sal/log.hxx> +#include <config_qrcodegen.h> + +#if ENABLE_QRCODEGEN #if defined(SYSTEM_QRCODEGEN) #include <qrcodegen/QrCode.hpp> #else #include <QrCode.hpp> #endif +#endif #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> @@ -58,7 +62,9 @@ using namespace css::sheet; using namespace css::text; using namespace css::drawing; using namespace css::graphic; +#if ENABLE_QRCODEGEN using namespace qrcodegen; +#endif QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel, bool bEditExisting) @@ -105,14 +111,19 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel short QrCodeGenDialog::run() { +#if ENABLE_QRCODEGEN short nRet = GenericDialogController::run(); if (nRet == RET_OK) Apply(); return nRet; +#else + return RET_CANCEL; +#endif } void QrCodeGenDialog::Apply() { +#if ENABLE_QRCODEGEN css::drawing::QRCode aQRCode; aQRCode.Payload = m_xEdittext->get_text(); @@ -232,13 +243,12 @@ void QrCodeGenDialog::Apply() throw uno::RuntimeException("Not implemented"); } } +#endif } OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRBorder) { -#if ENABLE_FUZZERS - return OUString(); -#else +#if ENABLE_QRCODEGEN //Select ECC:: value from aQrECC qrcodegen::QrCode::Ecc bqrEcc = qrcodegen::QrCode::Ecc::LOW; @@ -274,8 +284,12 @@ OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRB qrcodegen::QrCode qr0 = qrcodegen::QrCode::encodeText(qrtext, bqrEcc); std::string svg = qr0.toSvgString(aQRBorder); //cstring to OUString - char* cstr = &svg[0]; - return OUString::createFromAscii(cstr); + return OUString::createFromAscii(svg.c_str()); +#else + (void)aQRText; + (void)aQRECC; + (void)aQRBorder; + return OUString(); #endif } diff --git a/distro-configs/LibreOfficeOssFuzz.conf b/distro-configs/LibreOfficeOssFuzz.conf index ab9ec3b3b01e..60fec4bc4c44 100644 --- a/distro-configs/LibreOfficeOssFuzz.conf +++ b/distro-configs/LibreOfficeOssFuzz.conf @@ -15,5 +15,6 @@ --disable-dbus --disable-cups --disable-odk +--disable-qrcodegen --without-java --enable-ld=gold diff --git a/external/qrcodegen/Module_qrcodegen.mk b/external/qrcodegen/Module_qrcodegen.mk index 34be04cc52d9..09c771d0d535 100644 --- a/external/qrcodegen/Module_qrcodegen.mk +++ b/external/qrcodegen/Module_qrcodegen.mk @@ -13,8 +13,12 @@ $(eval $(call gb_Module_add_targets,qrcodegen,\ UnpackedTarball_qrcodegen \ )) +ifeq ($(ENABLE_QRCODEGEN),TRUE) + $(eval $(call gb_Module_add_targets,qrcodegen,\ StaticLibrary_qrcodegen \ )) +endif + # vim: set noet sw=4 ts=4: commit 5fec456a765f09337f39b94166bce28668438205 Author: Caolán McNamara <[email protected]> AuthorDate: Tue Sep 15 16:36:17 2020 +0100 Commit: Andras Timar <[email protected]> CommitDate: Thu Sep 24 13:12:51 2020 +0200 ofz#25684 keep ParseCMAP within legal area Change-Id: Iee18b5a9390b79efa67414ea2d229d2816c84e18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102776 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit a014c82522834c972e247a28d8e5f42998ae3c0e) ofz#25696 OOM Change-Id: Ia69e9ce1ca0156e960dddb7e0bf98dfd2be2d7cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102846 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit d57b14e3394b081adf0888ed8dcb7b86d66c246c) ofz#25774 keep ParseCMAP within legal area Change-Id: Ic68fadd3d63631cbccda76e7679d95bb89452d25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103017 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit f8474367449a1b6b54918d2753e3a36798761839) Fix crash from broken font CMAP subtable ParseCMAP crashes on a broken CMAP subtable of a font used by the bugdoc of tdf#119074, which returns a negative offset (technically it's large positive offset turning into a wrong negative integer, which is still out of bounds of the CMAP overall size - you get the point). This simply ignores that broken subtable, checking for other existing ones. Regressed-by: c7482bc2904401e7d975b5721ec861b8589253f9 Change-Id: I95820fe3bb6bd2fe2e0cf9d4c3536abce31fd497 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103033 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit 9bf4c5ac49b73cc2a8c89a87ff87238c061a579d) Missing include (for std::max, since f8474367449a1b6b54918d2753e3a36798761839 "ofz#25774 keep ParseCMAP within legal area") Change-Id: I873c788577e9ec3bd54d9e637d2cf86be7c1f6e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103089 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 8cc52b05744443c64cf5eb62ebe3098cd964c437) ofz#25855 overflow in nTmpOffset we already know nLength is >= 24 so just move the calc to the other term Change-Id: Ic52f1686ccf81e6b13d7eb7e74dbd9cb51c8ea01 ofz#25868 Timeout, encoding conversion only sane in 0..SAL_MAX_UINT16 range so ignore points outside that range to avoid ludicrous ranges that aren't possible in the input encoding Change-Id: Ifb7b9b389d4a31b8820a7da661249223fe1e110c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103261 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx index 9c8b54682041..92760875b647 100644 --- a/vcl/source/font/fontcharmap.cxx +++ b/vcl/source/font/fontcharmap.cxx @@ -21,6 +21,7 @@ #include <rtl/textenc.h> #include <sal/log.hxx> +#include <algorithm> #include <vector> #include <set> @@ -150,6 +151,10 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) continue; int nTmpOffset = GetUInt( p+4 ); + + if (nTmpOffset > nLength - 2 || nTmpOffset < 0) + continue; + int nTmpFormat = GetUShort( pCmap + nTmpOffset ); if( nTmpFormat == 12 ) // 32bit code -> glyph map format nValue += 3; @@ -179,12 +184,29 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) { int nSegCountX2 = GetUShort( pCmap + nOffset + 6 ); nRangeCount = nSegCountX2/2 - 1; - pCodePairs = new sal_UCS4[ nRangeCount * 2 ]; - pStartGlyphs = new int[ nRangeCount ]; + if (nRangeCount < 0) + { + SAL_WARN("vcl.gdi", "negative RangeCount"); + nRangeCount = 0; + } + const unsigned char* pLimitBase = pCmap + nOffset + 14; const unsigned char* pBeginBase = pLimitBase + nSegCountX2 + 2; const unsigned char* pDeltaBase = pBeginBase + nSegCountX2; const unsigned char* pOffsetBase = pDeltaBase + nSegCountX2; + + const int nOffsetBaseStart = pOffsetBase - pCmap; + const int nRemainingLen = nLength - nOffsetBaseStart; + const int nMaxPossibleRangeOffsets = nRemainingLen / 2; + if (nRangeCount > nMaxPossibleRangeOffsets) + { + SAL_WARN("vcl.gdi", "more range offsets requested then space available"); + nRangeCount = std::max(0, nMaxPossibleRangeOffsets); + } + + pCodePairs = new sal_UCS4[ nRangeCount * 2 ]; + pStartGlyphs = new int[ nRangeCount ]; + sal_UCS4* pCP = pCodePairs; for( int i = 0; i < nRangeCount; ++i ) { @@ -244,7 +266,7 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) if (nRangeCount > nMaxPossiblePairs) { SAL_WARN("vcl.gdi", "more code pairs requested then space available"); - nRangeCount = nMaxPossiblePairs; + nRangeCount = std::max(0, nMaxPossiblePairs); } pCodePairs = new sal_UCS4[ nRangeCount * 2 ]; @@ -318,7 +340,9 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) { sal_UCS4 cMin = *(pCP++); sal_UCS4 cEnd = *(pCP++); - while( cMin < cEnd ) + // ofz#25868 the conversion only makes sense with + // input codepoints in 0..SAL_MAX_UINT16 range + while (cMin < cEnd && cMin <= SAL_MAX_UINT16) { int j = 0; for(; (cMin < cEnd) && (j < NINSIZE); ++cMin ) commit a37173b6a14d2ab5a76edc2623dc8f7c954558c4 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Sep 23 12:44:14 2020 +0100 Commit: Andras Timar <[email protected]> CommitDate: Thu Sep 24 13:12:45 2020 +0200 ofz#25881 use std::vector with bounds checking accessor Change-Id: Ic557e85bce5f3ebe7224b0aa2192a74969f4fce2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103194 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index 448599e5b2c5..b4805ae6d9af 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -855,7 +855,7 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow( ConvertTable(pTmpTable.get(),nStartHeadRow,nEndHeadRow,0,nCol); sal_uInt16 nRowNum = pTmpTable->GetRowCount(); - std::unique_ptr<sal_uInt8[]> CellMark( new sal_uInt8[nRowNum] ); + std::vector<sal_uInt8> CellMark(nRowNum); if (nRowNum == 1) { @@ -867,11 +867,11 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow( else { sal_uInt8 nFirstColSpann = 1; - const bool bFindFlag = FindSplitColMark(pTmpTable.get(),CellMark.get(),nFirstColSpann); + const bool bFindFlag = FindSplitColMark(pTmpTable.get(), CellMark, nFirstColSpann); if (bFindFlag)//split to 2 cells { - SplitRowToCells(pTmpTable.get(),pXFTable,nFirstColSpann,CellMark.get()); + SplitRowToCells(pTmpTable.get(), pXFTable, nFirstColSpann, CellMark.data()); nContentRow = nEndHeadRow; } else//can not split,the first row will be the heading row,the rest will be content row @@ -987,7 +987,7 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable, rtl::Reference<XFTable> * @param pXFTable - pointer of tmp XFtable * @param CellMark - pointer of cell mark array */ -bool LwpTableLayout::FindSplitColMark(XFTable* pXFTable, sal_uInt8* pCellMark, +bool LwpTableLayout::FindSplitColMark(XFTable* pXFTable, std::vector<sal_uInt8>& rCellMark, sal_uInt8& nMaxColSpan) { sal_uInt16 nRowNum = pXFTable->GetRowCount(); @@ -1017,7 +1017,7 @@ bool LwpTableLayout::FindSplitColMark(XFTable* pXFTable, sal_uInt8* pCellMark, } if (nColSpan > nMaxColSpan) nMaxColSpan = nColSpan; - pCellMark[nRowLoop] = 0;//reset all cell mark to zero + rCellMark.at(nRowLoop) = 0;//reset all cell mark to zero } //find if other row has the same column @@ -1040,11 +1040,11 @@ bool LwpTableLayout::FindSplitColMark(XFTable* pXFTable, sal_uInt8* pCellMark, if (nCellMark == 0) break; else - pCellMark[nRowLoop] = nCellMark; + rCellMark.at(nRowLoop) = nCellMark; } for(nRowLoop=1;nRowLoop<=nRowNum;nRowLoop++)//check if all ==0,break { - if (pCellMark[nRowLoop] == 0) + if (rCellMark.at(nRowLoop) == 0) break; } if (nRowLoop == nRowNum+1) diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx index 5e232dba73b4..97e2ac10acbe 100644 --- a/lotuswordpro/source/filter/lwptablelayout.hxx +++ b/lotuswordpro/source/filter/lwptablelayout.hxx @@ -141,7 +141,7 @@ private: sal_uInt8 nEndCol, sal_uInt16 nRowID); void ConvertColumn(rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nStartCol, sal_uInt8 nEndCol); sal_uInt16 ConvertHeadingRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt16 nStartHeadRow,sal_uInt16 nEndHeadRow); - static bool FindSplitColMark(XFTable* pXFTable,sal_uInt8* pCellMark,sal_uInt8& nMaxColSpan); + static bool FindSplitColMark(XFTable* pXFTable, std::vector<sal_uInt8>& rCellMark, sal_uInt8& nMaxColSpan); void SplitRowToCells(XFTable* pTmpTable, rtl::Reference<XFTable> const & pXFTable, sal_uInt8 nFirstColSpann, const sal_uInt8* pCellMark); commit b95611917f53d8c304b9720af1388b6d73f99631 Author: Oleg Schelykalnov <[email protected]> AuthorDate: Fri Jun 19 09:37:56 2020 +0300 Commit: Andras Timar <[email protected]> CommitDate: Thu Sep 24 13:12:39 2020 +0200 tdf#134112 sw: Test access of text field master object Change-Id: I793528faa6d73f7a97ddd4409ae8a1a3e611cea1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96678 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/qa/python/xtextfieldssupplier.py b/sw/qa/python/xtextfieldssupplier.py index ab1e96f89246..f99b0fc85ab7 100755 --- a/sw/qa/python/xtextfieldssupplier.py +++ b/sw/qa/python/xtextfieldssupplier.py @@ -69,8 +69,11 @@ class TestXTextFieldsSupplier(unittest.TestCase): for masterName in masterNames: self.assertTrue(xFieldMasters.hasByName(masterName), "TextFieldMaster has no element " + masterName) - self.assertIsNotNone(xFieldMasters.getByName(masterName), + master = xFieldMasters.getByName(masterName) + self.assertIsNotNone(master, "can't get " + masterName + " from TextFieldMaster") + self.assertIsNotNone(master.getPropertyValue("Name"), + "can't get Name property from TextFieldMaster " + masterName) # Ensure that invalid elements are not accessible invalidMasterName = "com.sun.star.text.fieldmaster.SetExpression.NoSuchMaster" commit 11eed18fea97267cf75ea575e71fd60bd6f317f6 Author: Tomofumi Yagi <[email protected]> AuthorDate: Fri Sep 18 16:21:43 2020 +0900 Commit: Andras Timar <[email protected]> CommitDate: Thu Sep 24 13:12:32 2020 +0200 tdf#134157 fix Edit with external tool causes a CPU hit Switch Idle to 100ms Timer for fixing the bug Change-Id: I85a9bdcb173edd28d952d8e91c1b93d748e69206 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102984 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> (cherry picked from commit f110c037114f90d219ac8d149542bf96fe66a2f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103055 Reviewed-by: Caolán McNamara <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103130 diff --git a/include/svtools/filechangedchecker.hxx b/include/svtools/filechangedchecker.hxx index ec8d8a41fdac..a1c2fcb38eaa 100644 --- a/include/svtools/filechangedchecker.hxx +++ b/include/svtools/filechangedchecker.hxx @@ -28,7 +28,7 @@ class Timer; class SVT_DLLPUBLIC FileChangedChecker { private: - Idle mIdle; + Timer mTimer; OUString const mFileName; TimeValue mLastModTime; ::std::function<void ()> const mpCallback; diff --git a/svtools/source/misc/filechangedchecker.cxx b/svtools/source/misc/filechangedchecker.cxx index 09e24c3fafb1..8536eb0bda57 100644 --- a/svtools/source/misc/filechangedchecker.cxx +++ b/svtools/source/misc/filechangedchecker.cxx @@ -16,7 +16,7 @@ FileChangedChecker::FileChangedChecker(const OUString& rFilename, const ::std::function<void ()>& rCallback) - : mIdle("SVTools FileChangedChecker Idle") + : mTimer("SVTools FileChangedChecker Timer") , mFileName(rFilename) , mLastModTime() , mpCallback(rCallback) @@ -24,21 +24,24 @@ FileChangedChecker::FileChangedChecker(const OUString& rFilename, // Get the curren last file modified Status getCurrentModTime(mLastModTime); - // associate the callback function for the Idle - mIdle.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler)); + // associate the callback function for the Timer + mTimer.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler)); - //start the timer + // set timer interval + mTimer.SetTimeout(100); + + // start the timer resetTimer(); } void FileChangedChecker::resetTimer() { - //Start the Idle if it's not active - if(!mIdle.IsActive()) - mIdle.Start(); + // Start the Idle if it's not active + if(!mTimer.IsActive()) + mTimer.Start(); // Set lowest Priority - mIdle.SetPriority(TaskPriority::LOWEST); + mTimer.SetPriority(TaskPriority::LOWEST); } bool FileChangedChecker::getCurrentModTime(TimeValue& o_rValue) const @@ -90,7 +93,7 @@ IMPL_LINK_NOARG(FileChangedChecker, TimerHandler, Timer *, void) mpCallback(); } - // Reset the Idle in any case + // Reset the Timer in any case resetTimer(); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
