[Libreoffice-commits] core.git: 2 commits - dbaccess/source framework/inc framework/source

2022-12-14 Thread Noel Grandin (via logerrit)
 dbaccess/source/ui/querydesign/limitboxcontroller.cxx |   23 --
 dbaccess/source/ui/querydesign/limitboxcontroller.hxx |9 --
 framework/inc/uielement/menubarwrapper.hxx|   11 ---
 framework/source/uielement/menubarwrapper.cxx |   64 --
 4 files changed, 6 insertions(+), 101 deletions(-)

New commits:
commit 6fd64a87add9958b603b6851e0d477c4f596c22f
Author: Noel Grandin 
AuthorDate: Wed Dec 14 16:13:09 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 14 16:25:04 2022 +

loplugin:implinheritancehelper in framework

use more ImplInheritanceHelper to reduce boilerplate

Change-Id: I47eefb8edc2041fa89e64f930b1997566562d51a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144162
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/framework/inc/uielement/menubarwrapper.hxx 
b/framework/inc/uielement/menubarwrapper.hxx
index d696ec6c3f38..c764ecdf14b8 100644
--- a/framework/inc/uielement/menubarwrapper.hxx
+++ b/framework/inc/uielement/menubarwrapper.hxx
@@ -28,21 +28,14 @@
 namespace framework
 {
 
-class MenuBarWrapper final : public UIConfigElementWrapperBase,
-   public css::container::XNameAccess
+typedef cppu::ImplInheritanceHelper< UIConfigElementWrapperBase, 
css::container::XNameAccess> MenuBarWrapper_Base;
+class MenuBarWrapper final : public MenuBarWrapper_Base
 
 {
 public:
 MenuBarWrapper( css::uno::Reference< css::uno::XComponentContext > 
xContext );
 virtual ~MenuBarWrapper() override;
 
-//  XInterface, XTypeProvider
-virtual css::uno::Any  SAL_CALL queryInterface( const css::uno::Type& 
aType ) override;
-virtual void SAL_CALL acquire() noexcept override;
-virtual void SAL_CALL release() noexcept override;
-virtual css::uno::Sequence< css::uno::Type >  SAL_CALL getTypes() 
override;
-virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 
override;
-
 MenuBarManager* GetMenuBarManager() const { return static_cast< 
MenuBarManager* >( m_xMenuBarManager.get() ); }
 
 // XComponent
diff --git a/framework/source/uielement/menubarwrapper.cxx 
b/framework/source/uielement/menubarwrapper.cxx
index 3bbd71ed785e..c1ac0025d55e 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -45,72 +45,10 @@ using namespace ::com::sun::star::ui;
 namespace framework
 {
 
-void SAL_CALL MenuBarWrapper::acquire() noexcept   
   \
-{  
 \
-/* Don't use mutex in methods of XInterface! */
 \
-UIConfigElementWrapperBase::acquire(); 

  \
-}  
 \
-   
 \
-void SAL_CALL MenuBarWrapper::release() noexcept   
   \
-{  
 \
-/* Don't use mutex in methods of XInterface! */
 \
-UIConfigElementWrapperBase::release(); 

  \
-}
-
-css::uno::Any SAL_CALL MenuBarWrapper::queryInterface( const css::uno::Type& 
aType )
-{
-/* Attention: Don't use mutex or guard in this method!!! Is a method of 
XInterface. */
-/* Ask for my own supported interfaces ... 
 */
-css::uno::Any aReturn  = ::cppu::queryInterface( aType,
-static_cast< css::lang::XTypeProvider* >( this ),
-static_cast< css::ui::XUIElement* >( this ),
-static_cast< css::ui::XUIElementSettings* >( this ),
-static_cast< css::beans::XMultiPropertySet* >( this ),
-static_cast< css::beans::XFastPropertySet* >( this ),
-static_cast< css::beans::XPropertySet* >( this ),
-static_cast< css::lang::XInitialization* >( this ),
-static_cast< css::lang::XComponent* >( this ),
-

[Libreoffice-commits] core.git: 2 commits - dbaccess/source framework/inc framework/source

2019-01-29 Thread Libreoffice Gerrit user
 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