[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - extensions/source

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 20 13:17:38 UTC 2019


 extensions/source/ole/unoobjw.cxx |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit b0f86853b51391b2c2a08b48efe90c619161a60f
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Jun 11 08:12:14 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Sep 20 15:16:47 2019 +0200

    It is not a good idea to allocate a UNO object statically
    
    I should have known that. But sometimes you subconsciously just want
    things to be easy for change. But no. This fixes a problem that showed
    up in CppunitTest_services.
    
    Change-Id: Iaefcbe4a07716f4d1b2c269627a99d43e3738af3
    (cherry picked from commit a11cdfd392dfcfe0117893e1fc4ca18c3bc69f66)
    Reviewed-on: https://gerrit.libreoffice.org/79246
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 2ee61fd34ec2..9c70af4ad9c5 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -119,6 +119,7 @@ class TerminationVetoer : public WeakImplHelper<css::frame::XTerminateListener>
 public:
     int mnCount;
 
+private:
     TerminationVetoer()
         : mnCount(0)
     {
@@ -134,6 +135,15 @@ public:
         }
     }
 
+public:
+    static Reference< TerminationVetoer > get()
+    {
+        static TerminationVetoer* pInstance = new TerminationVetoer;
+        static Reference< TerminationVetoer > aInstance( pInstance );
+
+        return aInstance;
+    }
+
     // XTerminateListener
     void SAL_CALL queryTermination( const EventObject& ) override
     {
@@ -156,8 +166,6 @@ public:
     }
 };
 
-static TerminationVetoer aTerminationVetoer;
-
 /* Does not throw any exceptions.
    Param pInfo can be NULL.
  */
@@ -176,7 +184,7 @@ InterfaceOleWrapper::InterfaceOleWrapper( Reference<XMultiServiceFactory> const
         UnoConversionUtilities<InterfaceOleWrapper>( xFactory, unoWrapperClass, comWrapperClass),
         m_defaultValueType( 0)
 {
-    aTerminationVetoer.mnCount++;
+    TerminationVetoer::get()->mnCount++;
 }
 
 InterfaceOleWrapper::~InterfaceOleWrapper()
@@ -187,7 +195,7 @@ InterfaceOleWrapper::~InterfaceOleWrapper()
     if(it != UnoObjToWrapperMap.end())
         UnoObjToWrapperMap.erase(it);
 
-    aTerminationVetoer.mnCount--;
+    TerminationVetoer::get()->mnCount--;
 }
 
 STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, LPVOID FAR * ppv)


More information about the Libreoffice-commits mailing list