summaryrefslogtreecommitdiff
path: root/framework/inc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-01-26 15:09:30 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-01-26 15:10:28 +0100
commit7d9ac365039a23b704738b63a54bbbae6e9f6f3a (patch)
tree014b75b98683363082e7babe5229384a5e1dd087 /framework/inc
parent0b354d18ccfc05e7c2582f851d9201e2aa353d7d (diff)
Replace salhelper::SingletonRef with rtl::Static
When destroying the static vcl::CommandInfoProvider aProvider from vcl::CommandInfoProvider::Instance (vcl/source/helper/commandinfoprovider.cxx) during exit, it releases its mxCachedGlobalAcceleratorConfiguration reference on GlobalAcceleratorConfiguration (framework/source/accelerators/globalacceleratorconfiguration.cxx), which may get destroyed, whose base class framework::XCUBasedAcceleratorConfiguration (framework/source/inc/accelerators/acceleratorconfiguration.hxx) has a salhelper::SingletonRef<framework::KeyMapping> member, whose destructor (include/salhelper/singletonref.hxx) uses salhelper::SingletonRef<framework::KeyMapping>::SingletonLockInit::operator ()'s static osl::Mutex aInstance. If, during construction, the instantiation of salhelper::SingletonRef<framework::KeyMapping>::SingletonLockInit::operator ()'s static osl::Mutex aInstance finishes before the instantiation of vcl::CommandInfoProvider::Instance's static vcl::CommandInfoProvider aProvider, the corresponding atexit cleanup actions will be recorded in the right order, causing the above chain of calls to find the static Mutex still alive when used from within the static CommandInfoProvider's destruction. However, vcl::CommandInfoProvider's mxCachedGlobalAcceleratorConfiguration is only set to css::ui::GlobalAcceleratorConfiguration::create in vcl::CommandInfoProvider::GetGlobalAcceleratorConfiguration, so the instantiation of the static Mutex instance can finish after the instantiation of the static CommandInfoProvider instance, recording the atexit cleanup actions in the wrong order, causing the static Mutex to be used after destruction. This occasionally caused PythonTest_sfx2_python to hang during exit for me on Linux, where trying to lock a destroyed pthread mutex can apparently deadlock. rtl::Static does away with the need to do anything in the destructor, at the expense of always keeping the instance alive until exit (and not being able to recreate an already destroyed instance during exit, but code that would require that behavior would probably already be broken to begin with), so the order of creation of the CommandInfoProvider and GlobalAcceleratorConfiguration instances becomes less of a concern. Change-Id: Id6e3860ad9e5b7045980a0b9bf9eaef2e24129bb
Diffstat (limited to 'framework/inc')
-rw-r--r--framework/inc/xml/acceleratorconfigurationreader.hxx10
-rw-r--r--framework/inc/xml/acceleratorconfigurationwriter.hxx11
2 files changed, 0 insertions, 21 deletions
diff --git a/framework/inc/xml/acceleratorconfigurationreader.hxx b/framework/inc/xml/acceleratorconfigurationreader.hxx
index 6dc343d3662b..90365e5de9e6 100644
--- a/framework/inc/xml/acceleratorconfigurationreader.hxx
+++ b/framework/inc/xml/acceleratorconfigurationreader.hxx
@@ -23,7 +23,6 @@
#include <xml/saxnamespacefilter.hxx> // HACK: needed for MSVC 2013 ENABLE_LTO build: WeakImplHelper<XDocumentHandler>
#include <accelerators/acceleratorcache.hxx>
-#include <accelerators/keymapping.hxx>
#include <macros/xinterface.hxx>
#include <general.h>
@@ -31,7 +30,6 @@
#include <com/sun/star/xml/sax/XLocator.hpp>
-#include <salhelper/singletonref.hxx>
#include <cppuhelper/implbase.hxx>
#include <rtl/ustring.hxx>
@@ -85,14 +83,6 @@ class AcceleratorConfigurationReader : public ::cppu::WeakImplHelper< css::xml::
occurs recursive inside xml. */
bool m_bInsideAcceleratorItem;
- /** @short is used to map key codes to its
- string representation.
-
- @descr To perform this operation is
- created only one time and kept
- alive forever ...*/
- ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping;
-
/** @short provide information about the parsing state.
@descr We use it to find out the line and column, where
diff --git a/framework/inc/xml/acceleratorconfigurationwriter.hxx b/framework/inc/xml/acceleratorconfigurationwriter.hxx
index d46b2e93ff6a..e71c8893acf9 100644
--- a/framework/inc/xml/acceleratorconfigurationwriter.hxx
+++ b/framework/inc/xml/acceleratorconfigurationwriter.hxx
@@ -21,12 +21,9 @@
#define INCLUDED_FRAMEWORK_INC_XML_ACCELERATORCONFIGURATIONWRITER_HXX
#include <accelerators/acceleratorcache.hxx>
-#include <accelerators/keymapping.hxx>
#include <general.h>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-
-#include <salhelper/singletonref.hxx>
#include <rtl/ustring.hxx>
namespace framework{
@@ -45,14 +42,6 @@ class AcceleratorConfigurationWriter
writer must work on. */
const AcceleratorCache& m_rContainer;
- /** @short is used to map key codes to its
- string representation.
-
- @descr To perform this operation is
- created only one times and holded
- alive forever ...*/
- ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping;
-
// interface
public: