comphelper/source/misc/dispatchcommand.cxx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
New commits: commit e928e5295db7e11d8f8773076cf122b4d16ec9f2 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sat Apr 13 21:40:20 2019 -0400 Commit: Ashod Nakashian <ashnak...@gmail.com> CommitDate: Mon Apr 15 02:41:41 2019 +0200 comphelper: use dispatchwithNotification only when we have a callback Change-Id: Ica7448458ecc5e9adc802a288f72b1fceb709f79 Reviewed-on: https://gerrit.libreoffice.org/70724 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx index 90d181d2e0e4..73b778c53a4b 100644 --- a/comphelper/source/misc/dispatchcommand.cxx +++ b/comphelper/source/misc/dispatchcommand.cxx @@ -30,8 +30,9 @@ using namespace css; namespace comphelper { - -bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments, const uno::Reference<css::frame::XDispatchResultListener>& aListener) +bool dispatchCommand(const OUString& rCommand, + const css::uno::Sequence<css::beans::PropertyValue>& rArguments, + const uno::Reference<css::frame::XDispatchResultListener>& aListener) { // Target where we will execute the .uno: command uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); @@ -55,11 +56,17 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea return false; // And do the work... - uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY); - if (xNotifyingDisp.is()) - xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener); - else - xDisp->dispatch(aCommandURL, rArguments); + if (aListener.is()) + { + uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY); + if (xNotifyingDisp.is()) + { + xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener); + return true; + } + } + + xDisp->dispatch(aCommandURL, rArguments); return true; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits