framework/source/services/desktop.cxx | 42 ++++++---------------------------- 1 file changed, 8 insertions(+), 34 deletions(-)
New commits: commit 0f506617258341596747416549c8f0f879267ab0 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Dec 17 09:11:03 2019 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Dec 17 10:06:30 2019 +0100 Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics) Change-Id: I9ee0d2ecbb75afe5a341eac308bb6718e5830749 Reviewed-on: https://gerrit.libreoffice.org/85262 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 03e6bf2750f1..94f41f9fa1af 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -1771,40 +1771,13 @@ bool Desktop::impl_closeFrames(bool bAllowUI) namespace { -struct Instance { - explicit Instance( - css::uno::Reference<css::uno::XComponentContext> const & context): - instance(new framework::Desktop(context)) - { - instance->constructorInit(); - } - - rtl::Reference<framework::Desktop> instance; -}; - -struct InstanceInit { - Instance * operator() (css::uno::Reference<css::uno::XComponentContext> const& xContext) { - static Instance instance(xContext); - return &instance; - } -}; - -struct GetSolarMutex { - comphelper::SolarMutex * operator() () - { - return &Application::GetSolarMutex(); - } -}; - -Instance & getInstance(css::uno::Reference<css::uno::XComponentContext> const& xContext) +rtl::Reference<framework::Desktop> createDesktop( + css::uno::Reference<css::uno::XComponentContext> const & context) { - // tdf#114025 init with SolarMutex to avoid deadlock - return *rtl_Instance<Instance, - InstanceInit, - osl::Guard<comphelper::SolarMutex>, - GetSolarMutex, - css::uno::Reference<css::uno::XComponentContext> const> - ::create(InstanceInit(), GetSolarMutex(), xContext); + SolarMutexGuard g; // tdf#114025 init with SolarMutex to avoid deadlock + rtl::Reference<framework::Desktop> desktop(new framework::Desktop(context)); + desktop->constructorInit(); + return desktop; } } @@ -1814,7 +1787,8 @@ com_sun_star_comp_framework_Desktop_get_implementation( css::uno::XComponentContext *context, css::uno::Sequence<css::uno::Any> const &) { - return cppu::acquire(getInstance(context).instance.get()); + static auto const instance = createDesktop(context); + return cppu::acquire(instance.get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits