framework/inc/helper/mischelper.hxx |2 +
framework/source/fwe/classes/sfxhelperfunctions.cxx |3 +
framework/source/fwi/helper/mischelper.cxx |4 +-
framework/source/services/ContextChangeEventMultiplexer.cxx | 24 +++-
framework/util/fwk.component|3 +
include/framework/ContextChangeEventMultiplexerTunnel.hxx |2 +
sfx2/source/sidebar/SidebarController.cxx |4 +-
7 files changed, 20 insertions(+), 22 deletions(-)
New commits:
commit a9493229bb453a8f437c45d838777e2ba8217b76
Author: Noel Grandin
AuthorDate: Sun Mar 21 13:41:39 2021 +0200
Commit: Noel Grandin
CommitDate: Tue Mar 23 09:33:43 2021 +0100
use single-use attribute for ContextChangeEventMultiplexer
instead of rtl::Instance, which means it will get
cleaned up when UNO shuts down
Change-Id: I13b36f1fe570f789036ef54ecfb7d0a85ce1450c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112842
Tested-by: Jenkins
Reviewed-by: Noel Grandin
diff --git a/framework/inc/helper/mischelper.hxx
b/framework/inc/helper/mischelper.hxx
index 4dcb94003449..d05ae360a082 100644
--- a/framework/inc/helper/mischelper.hxx
+++ b/framework/inc/helper/mischelper.hxx
@@ -246,10 +246,12 @@ class WeakDocumentEventListener final : public
::cppu::WeakImplHelper
GetFirstListenerWith_Impl(
+css::uno::Reference const & xComponentContext,
css::uno::Reference const& xEventFocus,
std::function const&)> const&
rPredicate);
extern auto (*g_pGetMultiplexerListener)(
+css::uno::Reference const & xComponentContext,
css::uno::Reference const&,
std::function const&)> const&)
-> css::uno::Reference;
diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx
b/framework/source/fwe/classes/sfxhelperfunctions.cxx
index e456a7a42460..9adc5931a7e3 100644
--- a/framework/source/fwe/classes/sfxhelperfunctions.cxx
+++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx
@@ -146,10 +146,11 @@ bool IsDockingWindowVisible( const css::uno::Reference<
css::frame::XFrame >& rF
using namespace ::com::sun::star;
uno::Reference GetFirstListenerWith(
+css::uno::Reference const & xComponentContext,
uno::Reference const& xEventFocus,
std::function
const&)> const& rPredicate)
{
-return GetFirstListenerWith_Impl(xEventFocus, rPredicate);
+return GetFirstListenerWith_Impl(xComponentContext, xEventFocus,
rPredicate);
}
}
diff --git a/framework/source/fwi/helper/mischelper.cxx
b/framework/source/fwi/helper/mischelper.cxx
index b53cd0f2672d..e9c664d474df 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -133,17 +133,19 @@ void FillLangItems( std::set< OUString > &rLangItems,
}
auto (*g_pGetMultiplexerListener)(
+css::uno::Reference const & xComponentContext,
uno::Reference const&,
std::function
const&)> const&)
-> uno::Reference = nullptr;
uno::Reference
GetFirstListenerWith_Impl(
+css::uno::Reference const & xComponentContext,
uno::Reference const& xEventFocus,
std::function
const&)> const& rPredicate)
{
assert(g_pGetMultiplexerListener != nullptr); // should not be called too
early, nor too late
-return g_pGetMultiplexerListener(xEventFocus, rPredicate);
+return g_pGetMultiplexerListener(xComponentContext, xEventFocus,
rPredicate);
}
diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx
b/framework/source/services/ContextChangeEventMultiplexer.cxx
index fe24c2b6d770..3e647985cb40 100644
--- a/framework/source/services/ContextChangeEventMultiplexer.cxx
+++ b/framework/source/services/ContextChangeEventMultiplexer.cxx
@@ -23,11 +23,13 @@
#include
#include
#include
+#include
#include
#include
#include
#include
+#include
#include
#include
@@ -324,34 +326,21 @@ void SAL_CALL ContextChangeEventMultiplexer::disposing (
const css::lang::EventO
maListeners.erase(iDescriptor);
}
-struct Instance {
-explicit Instance():
-instance(static_cast(
-new ContextChangeEventMultiplexer()))
-{
-}
-
-css::uno::Reference instance;
-};
-
-struct Singleton:
-public rtl::Static
-{};
-
}
namespace framework {
// right now we assume there's one matching listener
static uno::Reference
GetFirstListenerWith_ImplImpl(
+css::uno::Reference const & xComponentContext,
uno::Reference const& xEventFocus,
std::function
const&)> const& rPredicate)
{
assert(xEventFocus.is()); // in current usage it's a bug if the
XController is null here
uno::Reference xRet;
-ContextChangeEventMultiplexer *const pMultiplexer(
-dynamic_cast(Singleton::get().instance.get()));
+rtl::Reference pMultiplexer =
+dynamic_cast(ui::ContextChangeEventMultiplexer::get(xComponentContext).get());
assert(pMultiplexer);
ContextCh