From 953db3ca96d0055a83f718794416a9e39b0b20ce Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Sat, 13 Apr 2019 21:40:20 -0400 Subject: comphelper: use dispatchwithNotification only when we have a callback Change-Id: Ica7448458ecc5e9adc802a288f72b1fceb709f79 Reviewed-on: https://gerrit.libreoffice.org/70724 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian Reviewed-on: https://gerrit.libreoffice.org/73492 Tested-by: Jenkins Reviewed-by: Jan Holesovsky --- comphelper/source/misc/dispatchcommand.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx index 0b5d3b18a65a..069a9d835032 100644 --- a/comphelper/source/misc/dispatchcommand.cxx +++ b/comphelper/source/misc/dispatchcommand.cxx @@ -48,11 +48,17 @@ bool dispatchCommand(const OUString& rCommand, const uno::Reference xNotifyingDisp(xDisp, uno::UNO_QUERY); - if (xNotifyingDisp.is()) - xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, rListener); - else - xDisp->dispatch(aCommandURL, rArguments); + if (rListener.is()) + { + uno::Reference xNotifyingDisp(xDisp, uno::UNO_QUERY); + if (xNotifyingDisp.is()) + { + xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, rListener); + return true; + } + } + + xDisp->dispatch(aCommandURL, rArguments); return true; } -- cgit