[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - extensions/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 11 05:30:03 UTC 2019
extensions/source/ole/unoobjw.cxx | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
New commits:
commit a11cdfd392dfcfe0117893e1fc4ca18c3bc69f66
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Jun 11 08:12:14 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Jun 11 08:26:48 2019 +0300
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
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 78254a834040..7df511f0016d 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -121,6 +121,7 @@ class TerminationVetoer : public WeakImplHelper<css::frame::XTerminateListener>
public:
int mnCount;
+private:
TerminationVetoer()
: mnCount(0)
{
@@ -136,6 +137,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
{
@@ -158,8 +168,6 @@ public:
}
};
-static TerminationVetoer aTerminationVetoer;
-
/* Does not throw any exceptions.
Param pInfo can be NULL.
*/
@@ -178,7 +186,7 @@ InterfaceOleWrapper::InterfaceOleWrapper( Reference<XMultiServiceFactory> const
UnoConversionUtilities<InterfaceOleWrapper>( xFactory, unoWrapperClass, comWrapperClass),
m_defaultValueType( 0)
{
- aTerminationVetoer.mnCount++;
+ TerminationVetoer::get()->mnCount++;
}
InterfaceOleWrapper::~InterfaceOleWrapper()
@@ -189,7 +197,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