dbaccess/source/core/dataaccess/datasource.cxx| 13 --
framework/inc/classes/protocolhandlercache.hxx|6 +--
framework/source/fwi/classes/protocolhandlercache.cxx | 35 +-
3 files changed, 30 insertions(+), 24 deletions(-)
New commits:
commit 48c6f4e0885976f9d8ccbffc5088f37bb5f1b9f0
Author: Michael Stahl
AuthorDate: Mon Jan 28 17:56:39 2019 +0100
Commit: Michael Stahl
CommitDate: Tue Jan 29 12:19:57 2019 +0100
framework: avoid crashing in ~HandlerCFGAccess() in atexit()
Commit d587931fba77246db3a2ccc6ab61ca77446d23f4 changed
HandlerCache::s_pConfig to a unique_ptr, which may now crash on
shutdown because it's a utl::ConfigItem and by atexit() time the
configmgr is long gone.
Due to the HandlerCache::m_nRefCount, the crash probably only happens
in case of an unclean shutdown, but we don't know whether this can
happen in practice or not, so just avoid crashing on shutdown.
Change-Id: Ifd2b782aa5592c344d1bc85acaa434c3f2a69b60
Reviewed-on: https://gerrit.libreoffice.org/67029
Tested-by: Jenkins
Reviewed-by: Michael Stahl
diff --git a/framework/inc/classes/protocolhandlercache.hxx
b/framework/inc/classes/protocolhandlercache.hxx
index 7f5af88f342e..a23acb57bc39 100644
--- a/framework/inc/classes/protocolhandlercache.hxx
+++ b/framework/inc/classes/protocolhandlercache.hxx
@@ -93,11 +93,11 @@ class FWI_DLLPUBLIC HandlerCache final
private:
/// list of all registered handler registered by her uno
implementation names
-static std::unique_ptr m_pHandler;
+static std::unique_ptr s_pHandler;
/// maps URL pattern to handler names
-static std::unique_ptr m_pPattern;
+static std::unique_ptr s_pPattern;
/// informs about config updates
-static std::unique_ptr m_pConfig;
+static HandlerCFGAccess* s_pConfig;
/// ref count to construct/destruct internal member lists on demand by
using singleton mechanism
static sal_Int32 m_nRefCount;
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx
b/framework/source/fwi/classes/protocolhandlercache.cxx
index 41a8d5005602..0c23aaa80f37 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -73,10 +73,10 @@ PatternHash::const_iterator findPatternKey(PatternHash
const * hash, const OUStr
That means it use two static member list to hold all necessary
information
and a ref count mechanism to create/destroy it on demand.
*/
-std::unique_ptr HandlerCache::m_pHandler;
-std::unique_ptr HandlerCache::m_pPattern;
+std::unique_ptr HandlerCache::s_pHandler;
+std::unique_ptr HandlerCache::s_pPattern;
sal_Int32HandlerCache::m_nRefCount = 0;
-std::unique_ptr HandlerCache::m_pConfig;
+HandlerCFGAccess* HandlerCache::s_pConfig = nullptr;
/**
@short ctor of the cache of all registered protocol handler
@@ -91,11 +91,11 @@ HandlerCache::HandlerCache()
if (m_nRefCount==0)
{
-m_pHandler.reset(new HandlerHash);
-m_pPattern.reset(new PatternHash);
-m_pConfig.reset(new HandlerCFGAccess(PACKAGENAME_PROTOCOLHANDLER));
-m_pConfig->read(*m_pHandler, *m_pPattern);
-m_pConfig->setCache(this);
+s_pHandler.reset(new HandlerHash);
+s_pPattern.reset(new PatternHash);
+s_pConfig = new HandlerCFGAccess(PACKAGENAME_PROTOCOLHANDLER);
+s_pConfig->read(*s_pHandler, *s_pPattern);
+s_pConfig->setCache(this);
}
++m_nRefCount;
@@ -112,11 +112,12 @@ HandlerCache::~HandlerCache()
if( m_nRefCount==1)
{
-m_pConfig->setCache(nullptr);
+s_pConfig->setCache(nullptr);
-m_pConfig.reset();
-m_pHandler.reset();
-m_pPattern.reset();
+delete s_pConfig;
+s_pConfig = nullptr;
+s_pHandler.reset();
+s_pPattern.reset();
}
--m_nRefCount;
@@ -133,10 +134,10 @@ bool HandlerCache::search( const OUString& sURL,
ProtocolHandler* pReturn ) cons
SolarMutexGuard aGuard;
-PatternHash::const_iterator pItem = findPatternKey(m_pPattern.get(), sURL);
-if (pItem!=m_pPattern->end())
+PatternHash::const_iterator pItem = findPatternKey(s_pPattern.get(), sURL);
+if (pItem != s_pPattern->end())
{
-*pReturn = (*m_pHandler)[pItem->second];
+*pReturn = (*s_pHandler)[pItem->second];
bFound = true;
}
@@ -158,8 +159,8 @@ void HandlerCache::takeOver(std::unique_ptr
pHandler, std::unique_p
{
SolarMutexGuard aGuard;
-m_pHandler = std::move(pHandler);
-m_pPattern = std::move(pPattern);
+s_pHandler = std::move(pHandler);
+s_pPattern = std::move(pPattern);
}
/**
commit 577a9708ea9594d60b66c1c71d24175c66d24096
Author: Michael Stahl
AuthorDate: Mon Jan 28 17:14:03 2019 +0100
Commit: Michael Stahl
CommitDate: Tue Jan