desktop/source/lib/init.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit 24c3426d07f5b8fcd19da6f4bc3ee7dd56758ab1 Author: Michael Stahl <mst...@redhat.com> Date: Mon Feb 1 12:31:32 2016 +0100 libreofficekit: fix inverted condition ... that prevented loading the same URL multiple times. Also make this exception-safe while at it. (cherry picked from commit 61e80cd9e3e425674e18221237b8b0574645f377) Change-Id: Ic71735fef1ad8f79a210279d4d03f1fd5fa8cf69 Reviewed-on: https://gerrit.libreoffice.org/22001 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 9d70ad2..f7a40cb 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -33,6 +33,7 @@ #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <comphelper/scopeguard.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -533,6 +534,12 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, rtl::Reference<LOKInteractionHandler> const pInteraction( new LOKInteractionHandler(::comphelper::getProcessComponentContext(), pLib)); auto const pair(pLib->mInteractionMap.insert(std::make_pair(aURL.toUtf8(), pInteraction))); + comphelper::ScopeGuard const g([&] () { + if (pair.second) + { + pLib->mInteractionMap.erase(aURL.toUtf8()); + } + }); uno::Reference<task::XInteractionHandler2> const xInteraction(pInteraction.get()); aFilterOptions[1].Name = "InteractionHandler"; aFilterOptions[1].Value <<= xInteraction; @@ -553,10 +560,6 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, aFilterOptions); assert(!xComponent.is() || pair.second); // concurrent loading of same URL ought to fail - if (!pair.second) - { - pLib->mInteractionMap.erase(aURL.toUtf8()); - } if (!xComponent.is()) {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits