svgio/source/svgreader/svgfecompositenode.cxx | 7 +++---- svl/source/numbers/zforlist.cxx | 16 ++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-)
New commits: commit faac1cda391865c304d853a553aad3dabd05e263 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Apr 19 08:52:46 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat Apr 20 11:52:24 2024 +0200 cid#1596242 Side effect in assertion Change-Id: Id9ffa49ae61824ee155cd4b5373d882381b40db0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166288 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index be23893d2571..9ae40a7f7f94 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -52,7 +52,7 @@ #include <rtl/strbuf.hxx> #include <rtl/math.hxx> -#include <math.h> +#include <atomic> #include <limits> #include <memory> #include <set> @@ -242,7 +242,7 @@ void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBro } } -static volatile bool bCurrencyTableInitialized = false; +static std::atomic<bool> g_CurrencyTableInitialized; SvNumberFormatterRegistry_Impl* SvNumberFormatter::pFormatterRegistry = nullptr; namespace @@ -3989,7 +3989,7 @@ void SvNumberFormatter::PrepForRoMode() SvNFEngine::Accessor SvNFEngine::GetROPolicy(const SvNFFormatData& rFormatData, SvNFFormatData::DefaultFormatKeysMap& rFormatCache) { assert(rFormatData.nDefaultSystemCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND && "ensure PrepForRoMode is called"); - assert(bCurrencyTableInitialized && "ensure PrepForRoMode is called"); + assert(g_CurrencyTableInitialized && "ensure PrepForRoMode is called"); return { std::bind(SvNFEngine::GetCLOffsetRO, std::ref(rFormatData), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), @@ -4112,7 +4112,7 @@ void SvNumberFormatter::resetTheCurrencyTable() SAL_INFO("svl", "Resetting the currency table."); nSystemCurrencyPosition = 0; - bCurrencyTableInitialized = false; + g_CurrencyTableInitialized = false; GetFormatterRegistry().ConfigurationChanged(nullptr, ConfigurationHints::Locale | ConfigurationHints::Currency | ConfigurationHints::DatePatterns); } @@ -4120,7 +4120,7 @@ void SvNumberFormatter::resetTheCurrencyTable() // static const NfCurrencyTable& SvNumberFormatter::GetTheCurrencyTable() { - while ( !bCurrencyTableInitialized ) + while (!g_CurrencyTableInitialized) ImpInitCurrencyTable(); return theCurrencyTable(); } @@ -4638,10 +4638,10 @@ void SvNumberFormatter::ImpInitCurrencyTable() { // Race condition possible: // ::osl::MutexGuard aGuard( GetMutex() ); - // while ( !bCurrencyTableInitialized ) + // while (!g_CurrencyTableInitialized) // ImpInitCurrencyTable(); static bool bInitializing = false; - if ( bCurrencyTableInitialized || bInitializing ) + if (g_CurrencyTableInitialized || bInitializing) { return ; } @@ -4792,7 +4792,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() pLocaleData.reset(); SvtSysLocaleOptions::SetCurrencyChangeLink( LINK( nullptr, SvNumberFormatter, CurrencyChangeLink ) ); bInitializing = false; - bCurrencyTableInitialized = true; + g_CurrencyTableInitialized = true; } static std::ptrdiff_t addToCurrencyFormatsList( NfWSStringsDtor& rStrArr, const OUString& rFormat ) commit 7ba388ee8c7eb8db66b45c541e1e8421756e8b52 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Apr 19 08:35:48 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat Apr 20 11:52:11 2024 +0200 cid#1596521 Resource leak Change-Id: I3064195408e508f1f77d22b82ad464a651064193 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166287 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/svgio/source/svgreader/svgfecompositenode.cxx b/svgio/source/svgreader/svgfecompositenode.cxx index c396eec78c0a..3eba9f300062 100644 --- a/svgio/source/svgreader/svgfecompositenode.cxx +++ b/svgio/source/svgreader/svgfecompositenode.cxx @@ -235,10 +235,9 @@ void SvgFeCompositeNode::apply(drawinglayer::primitive2d::Primitive2DContainer& aBmpEx = vcl::bitmap::DrawBitmapInRect(aBmpEx, aRange, aBaseRect); aBmpEx2 = vcl::bitmap::DrawBitmapInRect(aBmpEx2, aRange2, aBaseRect); - BitmapArithmeticBlendFilter* pArithmeticFilter - = new BitmapArithmeticBlendFilter(aBmpEx, aBmpEx2); - BitmapEx aResBmpEx = pArithmeticFilter->execute(maK1.getNumber(), maK2.getNumber(), - maK3.getNumber(), maK4.getNumber()); + BitmapArithmeticBlendFilter aArithmeticFilter(aBmpEx, aBmpEx2); + BitmapEx aResBmpEx = aArithmeticFilter.execute(maK1.getNumber(), maK2.getNumber(), + maK3.getNumber(), maK4.getNumber()); const drawinglayer::primitive2d::Primitive2DReference xRef( new drawinglayer::primitive2d::BitmapPrimitive2D(