[Libreoffice-commits] core.git: salhelper/source sax/source sccomp/source sc/inc sc/IwyuFilter_sc.yaml sc/qa scripting/source sc/source
salhelper/source/timer.cxx|1 sax/source/fastparser/fastparser.cxx |1 sc/IwyuFilter_sc.yaml | 41 +- sc/inc/ChartTools.hxx |3 sc/inc/ViewSettingsSequenceDefines.hxx|2 sc/inc/afmtuno.hxx|1 sc/inc/bigrange.hxx |1 sc/inc/bulkdatahint.hxx |1 sc/inc/cellsuno.hxx |1 sc/inc/chartuno.hxx |1 sc/inc/columniterator.hxx |2 sc/inc/conditio.hxx |1 sc/inc/detdata.hxx|1 sc/inc/document.hxx |1 sc/inc/documentlinkmgr.hxx|2 sc/inc/fielduno.hxx |1 sc/inc/helpids.h |2 sc/inc/math.hxx |2 sc/inc/matrixoperators.hxx|2 sc/inc/mtvfunctions.hxx |2 sc/inc/patattr.hxx|1 sc/inc/postit.hxx |1 sc/inc/pvfundlg.hrc |2 sc/inc/queryparam.hxx |1 sc/inc/refreshtimer.hxx |1 sc/inc/scabstdlg.hxx |1 sc/inc/scfuncs.hrc|2 sc/inc/scmod.hxx |1 sc/inc/scstyles.hrc |1 sc/inc/strings.hxx|2 sc/inc/subtotals.hrc |2 sc/inc/units.hrc |2 sc/inc/unonames.hxx |2 sc/inc/viewuno.hxx|1 sc/qa/extras/htmlexporttest.cxx |1 sc/qa/extras/macros-test.cxx |5 - sc/qa/extras/scchartsobj.cxx |1 sc/qa/extras/scindexenumeration_scenariosenumeration.cxx |1 sc/qa/extras/scindexenumeration_subtotalfieldsenumeration.cxx |1 sc/qa/extras/scindexenumeration_tablechartsenumeration.cxx|1 sc/qa/unit/scshapetest.cxx|2 sc/qa/unit/subsequent_export_test.cxx |4 sc/qa/unit/subsequent_export_test2.cxx|9 ++ sc/qa/unit/subsequent_filters_test.cxx|9 ++ sc/qa/unit/subsequent_filters_test2.cxx | 12 ++ sc/qa/unit/ucalc.cxx |4 sc/qa/unit/ucalc_condformat.cxx |3 sc/qa/unit/ucalc_copypaste.cxx|5 + sc/qa/unit/ucalc_formula.cxx |8 + sc/qa/unit/ucalc_sharedformula.cxx|4 sc/qa/unit/ucalc_sort.cxx |1 sc/qa/unit/uicalc/uicalc.cxx |2 sc/source/core/data/colorscale.cxx|1 sc/source/core/data/column3.cxx |1 sc/source/core/data/conditio.cxx |1 sc/source/core/data/docpool.cxx |2 sc/source/core/data/documen8.cxx |1 sc/source/core/data/dpdimsave.cxx |1 sc/source/core/data/dpobject.cxx |1 sc/source/core/data/drwlayer.cxx |1 sc/source/core/data/formulacell.cxx |1 sc/source/core/data/global.cxx|1 sc/source/core/data/markdata.cxx |1 sc/source/core/data/patattr.cxx |1 sc/source/core/data/table2.cxx|1 sc/source/core/data/table3.cxx|3 sc/source/core/data/validat.cxx |1 sc/source/core/inc/interpre.hxx |1 sc/source/core/tool/arraysumSSE2.cxx |1 sc/source/core/tool/cellform.cxx |1 sc/source
[Libreoffice-commits] core.git: salhelper/source
salhelper/source/thread.cxx |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) New commits: commit 47cdd3ba605324072db617c6ae2d1a647b8bdce6 Author: Noel Grandin AuthorDate: Wed Dec 1 09:57:16 2021 +0200 Commit: Noel Grandin CommitDate: Wed Dec 1 13:04:17 2021 +0100 revert part of "remove counter-productive catch-all blocks" as sberg points out, this rethrow will not necessarily crash the process Change-Id: I0ced6c102d1c0c1bf680b0903fcb232cc891bf92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126167 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/salhelper/source/thread.cxx b/salhelper/source/thread.cxx index 3d9c4b372005..190daf5081b6 100644 --- a/salhelper/source/thread.cxx +++ b/salhelper/source/thread.cxx @@ -22,8 +22,13 @@ void salhelper::Thread::launch() { // Assumption is that osl::Thread::create returns normally with a true // return value iff it causes osl::Thread::run to start executing: acquire(); -if (!create()) { -throw std::runtime_error("osl::Thread::create failed"); +try { +if (!create()) { +throw std::runtime_error("osl::Thread::create failed"); +} +} catch (...) { +release(); +throw; } }
[Libreoffice-commits] core.git: salhelper/source sc/source sd/source
salhelper/source/timer.cxx |1 - sc/source/ui/vba/vbaapplication.cxx | 11 +++ sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx | 14 -- sd/source/ui/tools/SdGlobalResourceContainer.cxx |9 ++--- 4 files changed, 21 insertions(+), 14 deletions(-) New commits: commit a2bb4fc9174637c065364f9740f164b27172d1f3 Author: Noel Grandin AuthorDate: Tue Nov 16 19:46:05 2021 +0200 Commit: Noel Grandin CommitDate: Tue Nov 16 19:53:51 2021 +0100 rtl::Static->thread-safe static Change-Id: I0f39dea1392eb2ba11881615aedbe386870282ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125324 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/salhelper/source/timer.cxx b/salhelper/source/timer.cxx index 430cdfe9138c..c0fba72ed68f 100644 --- a/salhelper/source/timer.cxx +++ b/salhelper/source/timer.cxx @@ -21,7 +21,6 @@ #include #include #include -#include #include diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 7c6e56dbf529..01885a36f0e3 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -57,7 +57,6 @@ #include "vbafiledialog.hxx" #include -#include #include #include @@ -117,7 +116,11 @@ ScVbaAppSettings::ScVbaAppSettings() : namespace { -struct ScVbaStaticAppSettings : public ::rtl::Static< ScVbaAppSettings, ScVbaStaticAppSettings > {}; +ScVbaAppSettings& ScVbaStaticAppSettings() +{ +static ScVbaAppSettings SINGLETON; +return SINGLETON; +} class ScVbaApplicationOutgoingConnectionPoint : public cppu::WeakImplHelper { @@ -158,7 +161,7 @@ ScVbaApplication::RemoveSink( sal_uInt32 nNumber ) ScVbaApplication::ScVbaApplication( const uno::Reference& xContext ) : ScVbaApplication_BASE( xContext ), -mrAppSettings( ScVbaStaticAppSettings::get() ), +mrAppSettings( ScVbaStaticAppSettings() ), m_nDialogType(0) { } @@ -169,7 +172,7 @@ ScVbaApplication::~ScVbaApplication() /*static*/ bool ScVbaApplication::getDocumentEventsEnabled() { -return ScVbaStaticAppSettings::get().mbEnableEvents; +return ScVbaStaticAppSettings().mbEnableEvents; } OUString SAL_CALL diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx index e3a4de5e3a06..d8117d5db145 100644 --- a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx +++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx @@ -18,7 +18,6 @@ */ #include "SlsCacheConfiguration.hxx" -#include #include #include @@ -36,8 +35,11 @@ namespace sd::slidesorter::cache { namespace { typedef std::shared_ptr CacheConfigSharedPtr; -class theInstance : -public rtl::Static {}; +CacheConfigSharedPtr& theInstance() +{ +static CacheConfigSharedPtr SINGLETON; +return SINGLETON; +} } std::weak_ptr CacheConfiguration::mpWeakInstance; @@ -45,7 +47,7 @@ std::weak_ptr CacheConfiguration::mpWeakInstance; std::shared_ptr CacheConfiguration::Instance() { SolarMutexGuard aSolarGuard; -CacheConfigSharedPtr &rInstancePtr = theInstance::get(); +CacheConfigSharedPtr &rInstancePtr = theInstance(); if (!rInstancePtr) { // Maybe somebody else kept a previously created instance alive. @@ -123,7 +125,7 @@ Any CacheConfiguration::GetValue (const OUString& rName) IMPL_STATIC_LINK_NOARG(CacheConfiguration, TimerCallback, Timer *, void) { -CacheConfigSharedPtr &rInstancePtr = theInstance::get(); +CacheConfigSharedPtr &rInstancePtr = theInstance(); // Release our reference to the instance. rInstancePtr.reset(); // note: if there are no other references to the instance, m_ReleaseTimer @@ -132,7 +134,7 @@ IMPL_STATIC_LINK_NOARG(CacheConfiguration, TimerCallback, Timer *, void) void CacheConfiguration::Shutdown() { -CacheConfigSharedPtr &rInstancePtr = theInstance::get(); +CacheConfigSharedPtr &rInstancePtr = theInstance(); rInstancePtr.reset(); assert(mpWeakInstance.expired()); // ensure m_ReleaseTimer is destroyed } diff --git a/sd/source/ui/tools/SdGlobalResourceContainer.cxx b/sd/source/ui/tools/SdGlobalResourceContainer.cxx index da46c1d98672..a7dbc5f25920 100644 --- a/sd/source/ui/tools/SdGlobalResourceContainer.cxx +++ b/sd/source/ui/tools/SdGlobalResourceContainer.cxx @@ -26,7 +26,6 @@ #include -#include #include #include @@ -53,7 +52,11 @@ public: namespace { -struct theSdGlobalResourceContainerInstance : public rtl::Static {}; +SdGlobalResourceContainerInstance& theSdGlobalResourceContainerInstance() +{ +static SdGlobalResourceContainerInstance SINGLETON; +return SINGLETON; +} } // namespace @@ -81,7 +84,7 @@ private: // static SdGlobalResourceContainer& SdGlobalResourceContainer::Instance() { -SdGlobalResourceContainer *const pRet(theSdGlobalResou
[Libreoffice-commits] core.git: salhelper/source
salhelper/source/timer.cxx | 121 + 1 file changed, 36 insertions(+), 85 deletions(-) New commits: commit e0b04e19bd71ce00f81b111399dad3b9da79e224 Author: Arnaud Versini AuthorDate: Sun Oct 17 21:19:13 2021 +0200 Commit: Noel Grandin CommitDate: Mon Oct 18 08:41:48 2021 +0200 salhelper : simplify salhelper::TimerManager initalization and use std::mutex Change-Id: I48c59e267683e081ef45049b280eb38ce231a39c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123723 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/salhelper/source/timer.cxx b/salhelper/source/timer.cxx index 8101b23875fb..999eaa80abbd 100644 --- a/salhelper/source/timer.cxx +++ b/salhelper/source/timer.cxx @@ -23,6 +23,8 @@ #include #include +#include + using namespace salhelper; class salhelper::TimerManager : public osl::Thread @@ -30,8 +32,6 @@ class salhelper::TimerManager : public osl::Thread public: TimerManager(); -virtual ~TimerManager() override; - /// register timer void registerTimer(salhelper::Timer* pTimer); @@ -41,9 +41,6 @@ public: /// lookup timer bool lookupTimer(const salhelper::Timer* pTimer); -/// retrieves the "Singleton" TimerManager Instance -static TimerManager* getTimerManager(); - protected: /// worker-function of thread virtual void SAL_CALL run() override; @@ -51,21 +48,28 @@ protected: /// Checking and triggering of a timer event void checkForTimeout(); -/// cleanup Method -virtual void SAL_CALL onTerminated() override; - /// sorted-queue data salhelper::Timer* m_pHead; /// List Protection -osl::Mutex m_Lock; +std::mutex m_Lock; /// Signal the insertion of a timer osl::Condition m_notEmpty; /// "Singleton Pattern" -static salhelper::TimerManager* m_pManager; +//static salhelper::TimerManager* m_pManager; }; +namespace +{ +salhelper::TimerManager& getTimerManager() +{ +static salhelper::TimerManager aManager; +return aManager; +} +} + + Timer::Timer() : m_aTimeOut(0), m_aExpired(0), @@ -102,29 +106,18 @@ void Timer::start() if (!m_aTimeOut.isEmpty()) setRemainingTime(m_aTimeOut); -TimerManager *pManager = TimerManager::getTimerManager(); - -if (pManager) -pManager->registerTimer(this); +getTimerManager().registerTimer(this); } } void Timer::stop() { -TimerManager *pManager = TimerManager::getTimerManager(); - -if (pManager) -pManager->unregisterTimer(this); +getTimerManager().unregisterTimer(this); } sal_Bool Timer::isTicking() const { -TimerManager *pManager = TimerManager::getTimerManager(); - -if (pManager) -return pManager->lookupTimer(this); -else -return false; +return getTimerManager().lookupTimer(this); } sal_Bool Timer::isExpired() const @@ -201,14 +194,6 @@ TTimeValue Timer::getRemainingTime() const return TTimeValue(secs, nsecs); } -namespace -{ -// Synchronize access to TimerManager -struct theTimerManagerMutex : public rtl::Static< osl::Mutex, theTimerManagerMutex> {}; -} - -TimerManager* salhelper::TimerManager::m_pManager = nullptr; - /** The timer manager cleanup has been removed (no thread is killed anymore), so the thread leaks. @@ -219,49 +204,21 @@ TimerManager* salhelper::TimerManager::m_pManager = nullptr; when there are no timers anymore ! **/ -TimerManager::TimerManager() +TimerManager::TimerManager() : +m_pHead(nullptr) { -osl::MutexGuard Guard(theTimerManagerMutex::get()); - -assert(m_pManager == nullptr); - -m_pManager = this; -m_pHead= nullptr; m_notEmpty.reset(); // start thread create(); } -TimerManager::~TimerManager() -{ -osl::MutexGuard Guard(theTimerManagerMutex::get()); - -if (m_pManager == this) -m_pManager = nullptr; -} - -void TimerManager::onTerminated() -{ -delete this; // FIXME -} - -TimerManager* TimerManager::getTimerManager() -{ -osl::MutexGuard Guard(theTimerManagerMutex::get()); - -if (! m_pManager) -new TimerManager; - -return m_pManager; -} - void TimerManager::registerTimer(Timer* pTimer) { if (!pTimer) return; -osl::MutexGuard Guard(m_Lock); +std::lock_guard Guard(m_Lock); // try to find one with equal or lower remaining time. Timer** ppIter = &m_pHead; @@ -297,7 +254,7 @@ void TimerManager::unregisterTimer(Timer const * pTimer) return; // lock access -osl::MutexGuard Guard(m_Lock); +std::lock_guard Guard(m_Lock); Timer** ppIter = &m_pHead; @@ -319,7 +276,7 @@ bool TimerManager::lookupTimer(const Timer* pTimer) return false; // lock access -osl::MutexGuard Guard(m_Lock); +std::lock_guard Guard(m_Lock);
[Libreoffice-commits] core.git: salhelper/source
salhelper/source/timer.cxx | 55 - 1 file changed, 10 insertions(+), 45 deletions(-) New commits: commit 3b0f8ece47f70f53b1462c824463c453b47c3020 Author: Chris Sherlock Date: Wed Jun 7 23:07:19 2017 +1000 tdf#43157 - salhelper: timer.cxx change OSL_ASSERT to assert There are a number of instances where OSL_ASSERT are just not necessary. Also, we need to change from testing if something is/is not equal to nullptr and just use the simpler form. Change-Id: I7e0b7deb12f0189030f66dd14ab23287341c82b7 Reviewed-on: https://gerrit.libreoffice.org/38507 Tested-by: Jenkins Reviewed-by: Chris Sherlock diff --git a/salhelper/source/timer.cxx b/salhelper/source/timer.cxx index 3757ea9a2cdc..435ea0a1f7e2 100644 --- a/salhelper/source/timer.cxx +++ b/salhelper/source/timer.cxx @@ -19,7 +19,6 @@ #include #include -#include #include #include #include @@ -106,12 +105,8 @@ void Timer::start() TimerManager *pManager = TimerManager::getTimerManager(); -OSL_ASSERT(pManager); - -if (pManager != nullptr) -{ +if (pManager) pManager->registerTimer(this); -} } } @@ -119,25 +114,18 @@ void Timer::stop() { TimerManager *pManager = TimerManager::getTimerManager(); -OSL_ASSERT(pManager); - -if (pManager != nullptr) -{ +if (pManager) pManager->unregisterTimer(this); -} } sal_Bool Timer::isTicking() const { TimerManager *pManager = TimerManager::getTimerManager(); -OSL_ASSERT(pManager); - if (pManager) return pManager->lookupTimer(this); else return false; - } sal_Bool Timer::isExpired() const @@ -151,16 +139,10 @@ sal_Bool Timer::isExpired() const sal_Bool Timer::expiresBefore(const Timer* pTimer) const { -OSL_ASSERT(pTimer); - -if (pTimer != nullptr) -{ +if (pTimer) return m_aExpired < pTimer->m_aExpired; -} else -{ return false; -} } void Timer::setAbsoluteTime(const TTimeValue& Time) @@ -242,12 +224,10 @@ TimerManager::TimerManager() { osl::MutexGuard Guard(theTimerManagerMutex::get()); -OSL_ASSERT(m_pManager == nullptr); +assert(m_pManager == nullptr); m_pManager = this; - m_pHead= nullptr; - m_notEmpty.reset(); // start thread @@ -258,7 +238,7 @@ TimerManager::~TimerManager() { osl::MutexGuard Guard(theTimerManagerMutex::get()); -if ( m_pManager == this ) +if (m_pManager == this) m_pManager = nullptr; } @@ -279,12 +259,8 @@ TimerManager* TimerManager::getTimerManager() void TimerManager::registerTimer(Timer* pTimer) { -OSL_ASSERT(pTimer); - -if ( pTimer == nullptr ) -{ +if (!pTimer) return; -} osl::MutexGuard Guard(m_Lock); @@ -318,12 +294,8 @@ void TimerManager::registerTimer(Timer* pTimer) void TimerManager::unregisterTimer(Timer* pTimer) { -OSL_ASSERT(pTimer); - -if ( pTimer == nullptr ) -{ +if (!pTimer) return; -} // lock access osl::MutexGuard Guard(m_Lock); @@ -344,12 +316,8 @@ void TimerManager::unregisterTimer(Timer* pTimer) bool TimerManager::lookupTimer(const Timer* pTimer) { -OSL_ASSERT(pTimer); - -if ( pTimer == nullptr ) -{ +if (!pTimer) return false; -} // lock access osl::MutexGuard Guard(m_Lock); @@ -358,9 +326,7 @@ bool TimerManager::lookupTimer(const Timer* pTimer) for (Timer* pIter = m_pHead; pIter != nullptr; pIter= pIter->m_pNext) { if (pIter == pTimer) -{ return true; -} } return false; @@ -368,10 +334,9 @@ bool TimerManager::lookupTimer(const Timer* pTimer) void TimerManager::checkForTimeout() { - m_Lock.acquire(); -if ( m_pHead == nullptr ) +if (!m_pHead) { m_Lock.release(); return; @@ -391,7 +356,7 @@ void TimerManager::checkForTimeout() pTimer->onShot(); // restart timer if specified -if ( ! pTimer->m_aRepeatDelta.isEmpty() ) +if (!pTimer->m_aRepeatDelta.isEmpty()) { TTimeValue Now; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: salhelper/source
salhelper/source/simplereferenceobject.cxx | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 3a2929e3f8dd3b0c57bc0c5e8496d23b6f63d925 Author: Tor Lillqvist Date: Thu Aug 6 10:03:01 2015 +0300 If we want this to crash intentionally, use abort() then free(NULL) does not crash, it is defined to do nothing. Did I not know that in 2010? Change-Id: Ia6c4817ea87b646d643a19daabfe7850c5416cc8 diff --git a/salhelper/source/simplereferenceobject.cxx b/salhelper/source/simplereferenceobject.cxx index f2ec5a7..95e8b6f 100644 --- a/salhelper/source/simplereferenceobject.cxx +++ b/salhelper/source/simplereferenceobject.cxx @@ -62,15 +62,15 @@ void SimpleReferenceObject::operator delete(void * pPtr, std::nothrow_t const &) #ifdef _MSC_VER /* This operator is supposed to be unimplemented, but that now leads - * to compilation and/or linking errors with MSVC2008. (Don't know - * about MSVC2010.) As it can be left unimplemented just fine with - * gcc, presumably it is never called. So do implement it then to - * avoid the compilation and/or linking errors, but make it crash - * intentionally if called. + * to compilation and/or linking errors with MSVC2008. Problem still + * there with MSVC2013. As it can be left unimplemented just fine with + * other compilers, presumably it is never called. So do implement it + * then to avoid the compilation and/or linking errors, but make it + * crash intentionally if called. */ void SimpleReferenceObject::operator delete[](void * /* pPtr */) { -free(NULL); +abort(); } #endif ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: salhelper/source
salhelper/source/timer.cxx | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) New commits: commit 6a8f848edecd1403686b4ad1232362908b1e2dbf Author: Alexander Wilms Date: Tue Feb 25 19:53:09 2014 +0100 Remove visual noise from salhelper Change-Id: Id01f525478558f2d280bfda7c970f4e16faaff44 Reviewed-on: https://gerrit.libreoffice.org/8298 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/salhelper/source/timer.cxx b/salhelper/source/timer.cxx index 164a5a8..d46c660 100644 --- a/salhelper/source/timer.cxx +++ b/salhelper/source/timer.cxx @@ -32,10 +32,10 @@ class salhelper::TimerManager : public osl::Thread public: -/// + TimerManager(); -/// + ~TimerManager(); /// register timer @@ -74,10 +74,10 @@ protected: }; -/ -// + + // Timer class -// + Timer::Timer() : m_aTimeOut( 0 ), @@ -232,10 +232,10 @@ TTimeValue Timer::getRemainingTime() const } -/ -// + + // Timer manager -// + namespace { // Synchronize access to TimerManager @@ -461,10 +461,10 @@ void TimerManager::run() } -/ -// + + // Timer manager cleanup -// + // jbu: // The timer manager cleanup has been removed (no thread is killed anymore). ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits