[Libreoffice-commits] core.git: sd/source
Michael Stahl
mstahl at redhat.com
Tue Aug 29 07:55:51 UTC 2017
sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx | 18 ++++++++++-----
sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx | 4 ++-
sd/source/ui/tools/SdGlobalResourceContainer.cxx | 4 +++
3 files changed, 20 insertions(+), 6 deletions(-)
New commits:
commit 9cd44d9426b95f9a449fb3ad56dac758747a0802
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Aug 28 22:39:25 2017 +0200
sd: delete the global CacheConfiguration timer on shutdown
Crashes in SchedulerMutex::acquire if destroyed from __run_exit_handlers
Change-Id: Ie8bbb399183d118d92c94a40f55cc9c650baf742
Reviewed-on: https://gerrit.libreoffice.org/41629
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
index 8bb01e4b7bbb..8d2be1ddcafb 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
@@ -41,7 +41,6 @@ namespace
}
std::weak_ptr<CacheConfiguration> CacheConfiguration::mpWeakInstance;
-Timer CacheConfiguration::maReleaseTimer;
std::shared_ptr<CacheConfiguration> CacheConfiguration::Instance()
{
@@ -58,11 +57,11 @@ std::shared_ptr<CacheConfiguration> CacheConfiguration::Instance()
rInstancePtr.reset(new CacheConfiguration());
mpWeakInstance = rInstancePtr;
// Prepare to release this instance in the near future.
- maReleaseTimer.SetInvokeHandler(
+ rInstancePtr->m_ReleaseTimer.SetInvokeHandler(
LINK(rInstancePtr.get(),CacheConfiguration,TimerCallback));
- maReleaseTimer.SetTimeout(5000 /* 5s */);
- maReleaseTimer.SetDebugName("sd::CacheConfiguration maReleaseTimer");
- maReleaseTimer.Start();
+ rInstancePtr->m_ReleaseTimer.SetTimeout(5000 /* 5s */);
+ rInstancePtr->m_ReleaseTimer.SetDebugName("sd::CacheConfiguration maReleaseTimer");
+ rInstancePtr->m_ReleaseTimer.Start();
}
}
return rInstancePtr;
@@ -131,6 +130,15 @@ IMPL_STATIC_LINK_NOARG(CacheConfiguration, TimerCallback, Timer *, void)
CacheConfigSharedPtr &rInstancePtr = theInstance::get();
// Release our reference to the instance.
rInstancePtr.reset();
+ // note: if there are no other references to the instance, m_ReleaseTimer
+ // will be deleted now
+}
+
+void CacheConfiguration::Shutdown()
+{
+ CacheConfigSharedPtr &rInstancePtr = theInstance::get();
+ rInstancePtr.reset();
+ assert(mpWeakInstance.expired()); // ensure m_ReleaseTimer is destroyed
}
} } } // end of namespace ::sd::slidesorter::cache
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx
index 74a8097f02db..5d2a22cc1c51 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx
@@ -39,6 +39,8 @@ public:
*/
static std::shared_ptr<CacheConfiguration> Instance();
+ static void Shutdown();
+
/** Look up the specified value in
MultiPaneGUI/SlideSorter/PreviewCache. When the specified value
does not exist then an empty Any is returned.
@@ -50,7 +52,7 @@ private:
this weak pointer to avoid creating a new instance.
*/
static std::weak_ptr<CacheConfiguration> mpWeakInstance;
- static Timer maReleaseTimer;
+ Timer m_ReleaseTimer;
css::uno::Reference<css::container::XNameAccess> mxCacheNode;
CacheConfiguration();
diff --git a/sd/source/ui/tools/SdGlobalResourceContainer.cxx b/sd/source/ui/tools/SdGlobalResourceContainer.cxx
index c1dc47bc917e..bcafcb52d701 100644
--- a/sd/source/ui/tools/SdGlobalResourceContainer.cxx
+++ b/sd/source/ui/tools/SdGlobalResourceContainer.cxx
@@ -19,6 +19,8 @@
#include "tools/SdGlobalResourceContainer.hxx"
+#include "../cache/SlsCacheConfiguration.hxx"
+
#include <comphelper/processfactory.hxx>
#include <comphelper/unique_disposing_ptr.hxx>
@@ -194,6 +196,8 @@ SdGlobalResourceContainer::~SdGlobalResourceContainer()
if (xComponent.is())
xComponent->dispose();
}
+
+ sd::slidesorter::cache::CacheConfiguration::Shutdown();
}
} // end of namespace sd
More information about the Libreoffice-commits
mailing list