diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.hxx | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 84d169cf708a..40febc9b422a 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -104,7 +104,7 @@ css::uno::Sequence<OUString> SAL_CALL ShutdownIcon::getSupportedServiceNames() } bool ShutdownIcon::bModalMode = false; -ShutdownIcon* ShutdownIcon::pShutdownIcon = nullptr; +rtl::Reference<ShutdownIcon> ShutdownIcon::pShutdownIcon; extern "C" { static void disabled_initSystray() { } @@ -474,23 +474,23 @@ void ShutdownIcon::terminateDesktop() ShutdownIcon* ShutdownIcon::getInstance() { OSL_ASSERT( pShutdownIcon ); - return pShutdownIcon; + return pShutdownIcon.get(); } ShutdownIcon* ShutdownIcon::createInstance() { if (pShutdownIcon) - return pShutdownIcon; + return pShutdownIcon.get(); try { - std::unique_ptr<ShutdownIcon> pIcon(new ShutdownIcon( comphelper::getProcessComponentContext() )); + rtl::Reference<ShutdownIcon> pIcon(new ShutdownIcon( comphelper::getProcessComponentContext() )); pIcon->init (); - pShutdownIcon = pIcon.release(); + pShutdownIcon = pIcon; } catch (...) { } - return pShutdownIcon; + return pShutdownIcon.get(); } void ShutdownIcon::init() diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index 6829330409de..32113cbc1ee2 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -27,6 +27,7 @@ #include <com/sun/star/beans/XFastPropertySet.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include <osl/mutex.hxx> #include <cppuhelper/compbase.hxx> #include <tools/link.hxx> @@ -68,7 +69,7 @@ class ShutdownIcon : public ShutdownIconServiceBase std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg; css::uno::Reference< css::uno::XComponentContext > m_xContext; - static ShutdownIcon *pShutdownIcon; // one instance + static rtl::Reference<ShutdownIcon> pShutdownIcon; // one instance bool m_bInitialized; void initSystray(); |