configure.ac | 2 cui/source/dialogs/SpellDialog.cxx | 2 sc/inc/arraysumfunctor.hxx | 17 ------- sc/inc/kahan.hxx | 66 ++++++++++++++++++++-------- sc/source/core/tool/arraysum.hxx | 36 --------------- sc/source/core/tool/arraysumSSE2.cxx | 6 -- sc/uiconfig/scalc/ui/notebookbar_compact.ui | 2 stoc/Library_javavm.mk | 6 ++ stoc/source/javavm/javavm.cxx | 15 ++++++ vcl/skia/osx/gdiimpl.cxx | 5 ++ 10 files changed, 79 insertions(+), 78 deletions(-)
New commits: commit a2baff69d478479498e92ef33b9dd98700229aa5 Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Thu Oct 19 11:27:31 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Oct 19 11:27:31 2023 +0200 Bump version to 23.05.5.2 Change-Id: I9c00f8a6d07d036d634261bef8ef66e385fc4945 diff --git a/configure.ac b/configure.ac index 58b0d7f12e10..6de649762bd5 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([Collabora Office],[23.05.5.1],[],[],[https://collaboraoffice.com/]) +AC_INIT([Collabora Office],[23.05.5.2],[],[],[https://collaboraoffice.com/]) dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard commit 4beab2956d339fb5caac1684135c3cab25d2363e Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Oct 18 16:47:20 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Oct 19 11:27:02 2023 +0200 crashreporting: svx::SentenceEditWindow_Impl::CreateSpellPortions() cui/source/dialogs/SpellDialog.cxx:2005 aRet[ aRet.size() - 1 ].sText += aLeftOverText; presumably aRet is empty() here a) don't bother appending if aLeftOverText is empty() b) don't crah if aRet is empty() and aLeftOverText is not Change-Id: Ie9a9585f572d8afb17183b479fb6f2cce5952aa7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158047 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 3c0db58e51a24bf08ca443af62489e761063f456) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158152 diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index cf7d03972bee..0975f5ebf245 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -2001,7 +2001,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const aPortion2.sText = aLeftOverText.makeStringAndClear(); aRet.push_back( aPortion2 ); } - else + else if (!aLeftOverText.isEmpty() && !aRet.empty()) { // we just need to append the left-over text to the last portion (which had no errors) aRet[ aRet.size() - 1 ].sText += aLeftOverText; } commit f8e36903fe78a41f5cee952e9fd573a75eccf25f Author: Patrick Luby <plub...@neooffice.org> AuthorDate: Sat Oct 14 21:13:26 2023 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Oct 19 11:27:02 2023 +0200 tdf#101376 don't detach thread if it is the main thread on macOS On macOS, many AWT classes do their work on the main thread deep in native methods in the java.awt.* classes. The problem is that Oracle's and OpenJDK's JVMs don't bracket their "perform on main thread" native calls with "attach/detach current thread" calls to the JVM. Change-Id: I0859dc9e20f34bd0b43bb321898507764fd530fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157985 Tested-by: Jenkins Reviewed-by: Patrick Luby <plub...@neooffice.org> (cherry picked from commit a0eee8e56b91324470bb0e15c6b8009cfc411335) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157962 diff --git a/stoc/Library_javavm.mk b/stoc/Library_javavm.mk index e096565769f9..adcb49691ce1 100644 --- a/stoc/Library_javavm.mk +++ b/stoc/Library_javavm.mk @@ -31,4 +31,10 @@ $(eval $(call gb_Library_add_exception_objects,javavm,\ stoc/source/javavm/jvmargs \ )) +ifeq ($(OS),MACOSX) +$(eval $(call gb_Library_use_system_darwin_frameworks,javavm,\ + CoreFoundation \ +)) +endif + # vim:set noet sw=4 ts=4: diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 12bcc2c904b7..dc22107fbf84 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -79,6 +79,12 @@ #define TIMEZONE "MET" #endif +#ifdef MACOSX +#include <premac.h> +#include <CoreFoundation/CoreFoundation.h> +#include <postmac.h> +#endif + /* Within this implementation of the com.sun.star.java.JavaVirtualMachine * service and com.sun.star.java.theJavaVirtualMachine singleton, the method * com.sun.star.java.XJavaVM.getJavaVM relies on the following: @@ -456,6 +462,15 @@ public: explicit DetachCurrentThread(JavaVM * jvm): m_jvm(jvm) {} ~DetachCurrentThread() { +#ifdef MACOSX + // tdf#101376 don't detach thread if it is the main thread on macOS + // On macOS, many AWT classes do their work on the main thread + // deep in native methods in the java.awt.* classes. The problem + // is that Oracle's and OpenJDK's JVMs don't bracket their + // "perform on main thread" native calls with "attach/detach + // current thread" calls to the JVM. + if (CFRunLoopGetCurrent() != CFRunLoopGetMain()) +#endif if (m_jvm->DetachCurrentThread() != 0) { OSL_ASSERT(false); } commit 8122d0d9a18187241f9c1a46b2197faed4d51d21 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Fri Oct 13 14:25:46 2023 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Oct 19 11:27:01 2023 +0200 tdf#141457 sc notebookbar_compact: fix empty Statistics menu Change-Id: If873da6e5d877a07bc4260fa5832cc29d73f4af5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157946 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> (cherry picked from commit e72064ac53ac3177d4ae451358ff013443565daa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157954 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit d9b697824f31c2e2beefb023241e39ee849fc77d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158033 diff --git a/sc/uiconfig/scalc/ui/notebookbar_compact.ui b/sc/uiconfig/scalc/ui/notebookbar_compact.ui index 327b2bd9f499..74667b11b5fd 100644 --- a/sc/uiconfig/scalc/ui/notebookbar_compact.ui +++ b/sc/uiconfig/scalc/ui/notebookbar_compact.ui @@ -7156,7 +7156,7 @@ </packing> </child> <child> - <object class="svtlo-ManagedMenuButton" id="Data-StatisticsMenu:MenuStatistic"> + <object class="svtlo-ManagedMenuButton" id="Data-StatisticsMenu:Menu Statistic"> <property name="label" translatable="yes" context="notebookbar_compact|Statistics">_Statistics</property> <property name="visible">True</property> <property name="can_focus">True</property> commit d911942932b9bdea7edd7d8b43245004b63bc466 Author: Eike Rathke <er...@redhat.com> AuthorDate: Sun Oct 15 17:29:01 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Oct 19 11:27:01 2023 +0200 Follow-up: tdf#156985 Use SC_USE_SSE2 to determine which KahanSum::add() to use Also, the CPU identifier for MSVC WIN32 is not X86 but INTEL, so actually use SSE2 there as well, which was the cause of things failing on that platform. For other platforms than Intel x86/x86_64 SSE2 is not defined, so exclude the new unit test based on that and live on with the old slightly off value. Experiments did not yield any solution that works, even using plain sumNeumaierNormal() (similar to SSE2) in the executeUnrolled() case instead of KahanSum with its m_fMem did not help, nor trying to add the internal values in different orders or with long double, au contraire the error was slightly larger. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156899 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit 361c4f008e48b08df635839d2e5dcad7389df44a) Conflicts: sc/qa/unit/ucalc_formula2.cxx Change-Id: Ica0b2963f76c01f248799e9a809ef06eb099e722 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157964 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index c261c120addf..c1eabb220e27 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -12,29 +12,12 @@ #include <cmath> #include "kahan.hxx" -#include "arraysumfunctor.hxx" #include <formula/errorcodes.hxx> namespace sc::op { -// Checkout available optimization options. -// Note that it turned out to be problematic to support CPU-specific code -// that's not guaranteed to be available on that specific platform (see -// git history). SSE2 is guaranteed on x86_64 and it is our baseline requirement -// for x86 on Windows, so SSE2 use is hardcoded on those platforms. -// Whenever we raise baseline to e.g. AVX, this may get -// replaced with AVX code (get it from git history). -// Do it similarly with other platforms. -#if defined(X86_64) || (defined(X86) && defined(_WIN32)) -#define SC_USE_SSE2 1 -KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); -#else -#define SC_USE_SSE2 0 -#endif - /** * If no boosts available, Unrolled KahanSum. - * Most likely to use on android. */ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pCurrent) { diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index ac97ae4394fa..03b05c25aa6b 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -12,6 +12,26 @@ #include <rtl/math.hxx> #include <cmath> +class KahanSum; +namespace sc::op +{ +// Checkout available optimization options. +// Note that it turned out to be problematic to support CPU-specific code +// that's not guaranteed to be available on that specific platform (see +// git commit 2d36e7f5186ba5215f2b228b98c24520bd4f2882). SSE2 is guaranteed on +// x86_64 and it is our baseline requirement for x86 on Windows, so SSE2 use is +// hardcoded on those platforms. +// Whenever we raise baseline to e.g. AVX, this may get +// replaced with AVX code (get it from mentioned git commit). +// Do it similarly with other platforms. +#if defined(X86_64) || (defined(INTEL) && defined(_WIN32)) +#define SC_USE_SSE2 1 +KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); +#else +#define SC_USE_SSE2 0 +#endif +} + /** * This class provides LO with Kahan summation algorithm * About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm @@ -41,6 +61,21 @@ public: constexpr KahanSum(const KahanSum& fSum) = default; public: + /** + * Performs one step of the Neumaier sum of doubles. + * Overwrites the summand and error. + * T could be double or long double. + */ + template <typename T> static inline void sumNeumaierNormal(T& sum, T& err, const double& value) + { + T t = sum + value; + if (std::abs(sum) >= std::abs(value)) + err += (sum - t) + value; + else + err += (value - t) + sum; + sum = t; + } + /** * Adds a value to the sum using Kahan summation. * @param x_i @@ -71,32 +106,27 @@ public: */ inline void add(const KahanSum& fSum) { -#ifdef _WIN32 - // For some odd unknown reason WIN32 fails badly with the - // sum+compensation value. Continue keeping the old though slightly off - // (see tdf#156985) explicit addition of the compensation value. - add(fSum.m_fSum); - add(fSum.m_fError); -#else +#if SC_USE_SSE2 add(fSum.m_fSum + fSum.m_fError); -#endif add(fSum.m_fMem); +#else + // Without SSE2 the sum+compensation value fails badly. Continue + // keeping the old though slightly off (see tdf#156985) explicit + // addition of the compensation value. + double sum = fSum.m_fSum; + double err = fSum.m_fError; + if (fSum.m_fMem != 0.0) + sumNeumaierNormal(sum, err, fSum.m_fMem); + add(sum); + add(err); +#endif } /** * Substracts a value to the sum using Kahan summation. * @param fSum */ - inline void subtract(const KahanSum& fSum) - { -#ifdef _WIN32 - add(-fSum.m_fSum); - add(-fSum.m_fError); -#else - add(-(fSum.m_fSum + fSum.m_fError)); -#endif - add(-fSum.m_fMem); - } + inline void subtract(const KahanSum& fSum) { add(-fSum); } public: constexpr KahanSum operator-() const diff --git a/sc/source/core/tool/arraysum.hxx b/sc/source/core/tool/arraysum.hxx deleted file mode 100644 index ce8a7f30f4dc..000000000000 --- a/sc/source/core/tool/arraysum.hxx +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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/. - * - */ - -#pragma once - -#include <math.h> - -namespace sc::op -{ -/** - * Performs one step of the Neumanier sum between doubles - * Overwrites the summand and error - * @parma sum - * @param err - * @param value - */ -inline void sumNeumanierNormal(double& sum, double& err, const double& value) -{ - double t = sum + value; - if (fabs(sum) >= fabs(value)) - err += (sum - t) + value; - else - err += (value - t) + sum; - sum = t; -} - -} // end namespace sc::op - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/arraysumSSE2.cxx b/sc/source/core/tool/arraysumSSE2.cxx index 5d962baf9900..f7b87070b70d 100644 --- a/sc/source/core/tool/arraysumSSE2.cxx +++ b/sc/source/core/tool/arraysumSSE2.cxx @@ -8,8 +8,6 @@ * */ -#include "arraysum.hxx" - #include <arraysumfunctor.hxx> #include <tools/simdsupport.hxx> @@ -106,8 +104,8 @@ KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent) // First Kahan & pairwise summation // 0+1 -> 0 - sumNeumanierNormal(sums[0], errs[0], sums[1]); - sumNeumanierNormal(sums[0], errs[0], errs[1]); + KahanSum::sumNeumaierNormal(sums[0], errs[0], sums[1]); + KahanSum::sumNeumaierNormal(sums[0], errs[0], errs[1]); // Store result return { sums[0], errs[0] }; commit 543ba161f3ae2c3d30aa88d91b632f775558c25d Author: Patrick Luby <plub...@neooffice.org> AuthorDate: Wed Oct 11 14:36:12 2023 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Oct 19 11:27:01 2023 +0200 tdf#157613 make sure surface is not a null pointer Change-Id: I8e3c1be3f05f7ccc1f3ba00093cd71a564e5ae9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157848 Reviewed-by: Patrick Luby <plub...@neooffice.org> Tested-by: Patrick Luby <plub...@neooffice.org> (cherry picked from commit bacdae0d6b0cec4de39812496f6ffafe04629411) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157871 Tested-by: Jenkins diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index fcb2d2181fc4..24847a410e7a 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -214,6 +214,11 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue) { + // tdf#157613 make sure surface is not a nullptr + checkSurface(); + if (!mSurface) + return false; + // rControlRegion is not the whole area that the control should be painted to (e.g. highlight // around focused lineedit is outside of it). Since we draw to a temporary bitmap, we need tofind out // the real size. Using getNativeControlRegion() might seem like the function to call, but we need