diff options
Diffstat (limited to 'configmgr/source/broadcaster.cxx')
-rw-r--r-- | configmgr/source/broadcaster.cxx | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/configmgr/source/broadcaster.cxx b/configmgr/source/broadcaster.cxx index 24b047e9d5a4..365e25f9eb02 100644 --- a/configmgr/source/broadcaster.cxx +++ b/configmgr/source/broadcaster.cxx @@ -35,6 +35,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/ustring.hxx> +#include <utility> #include "broadcaster.hxx" @@ -96,9 +97,12 @@ void Broadcaster::addPropertiesChangeNotification( void Broadcaster::addChangesNotification( css::uno::Reference< css::util::XChangesListener > const & listener, - css::util::ChangesEvent const & event) + css::util::ChangesEvent const & event, bool bRootListener) { - changesNotifications_.emplace_back(listener, event); + if (bRootListener) + rootChangesNotifications_.emplace_back(listener, event); + else + changesNotifications_.emplace_back(listener, event); } void Broadcaster::send() { @@ -163,19 +167,23 @@ void Broadcaster::send() { appendMessage(messages, e); } } - for (auto& rNotification : changesNotifications_) { - try { - rNotification.listener->changesOccurred(rNotification.event); - } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception & e) { - exception = cppu::getCaughtException(); - appendMessage(messages, e); + // First root listeners, then the rest + for (const auto& container : { rootChangesNotifications_ , changesNotifications_}) + { + for (auto& rNotification : container) { + try { + rNotification.listener->changesOccurred(rNotification.event); + } catch (css::lang::DisposedException &) { + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); + } } } if (exception.hasValue()) { throw css::lang::WrappedTargetRuntimeException( ("configmgr exceptions during listener notification" + - messages.makeStringAndClear()), + messages), css::uno::Reference< css::uno::XInterface >(), exception); } @@ -183,8 +191,8 @@ void Broadcaster::send() { Broadcaster::DisposeNotification::DisposeNotification( css::uno::Reference< css::lang::XEventListener > const & theListener, - css::lang::EventObject const & theEvent): - listener(theListener), event(theEvent) + css::lang::EventObject theEvent): + listener(theListener), event(std::move(theEvent)) { assert(theListener.is()); } @@ -192,8 +200,8 @@ Broadcaster::DisposeNotification::DisposeNotification( Broadcaster::ContainerNotification::ContainerNotification( css::uno::Reference< css::container::XContainerListener > const & theListener, - css::container::ContainerEvent const & theEvent): - listener(theListener), event(theEvent) + css::container::ContainerEvent theEvent): + listener(theListener), event(std::move(theEvent)) { assert(theListener.is()); } @@ -201,8 +209,8 @@ Broadcaster::ContainerNotification::ContainerNotification( Broadcaster::PropertyChangeNotification::PropertyChangeNotification( css::uno::Reference< css::beans::XPropertyChangeListener > const & theListener, - css::beans::PropertyChangeEvent const & theEvent): - listener(theListener), event(theEvent) + css::beans::PropertyChangeEvent theEvent): + listener(theListener), event(std::move(theEvent)) { assert(theListener.is()); } @@ -218,8 +226,8 @@ Broadcaster::PropertiesChangeNotification::PropertiesChangeNotification( Broadcaster::ChangesNotification::ChangesNotification( css::uno::Reference< css::util::XChangesListener > const & theListener, - css::util::ChangesEvent const & theEvent): - listener(theListener), event(theEvent) + css::util::ChangesEvent theEvent): + listener(theListener), event(std::move(theEvent)) { assert(theListener.is()); } |