diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2018-12-19 17:47:57 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2019-10-11 11:19:13 +0200 |
commit | b4158aedf18394c695a14708bc8ff14c601b1d3e (patch) | |
tree | 1949ff04d198b427be27295e0140f490d675c009 | |
parent | ba62661ae812f48482f14db361d5c7c2196ed7f4 (diff) |
framework: allow loading a component on the main thread
The user-visible problem was that embedded (OLE) objects contained in a
document that was loaded on a thread were not editable.
This works in the loaded-with-UI case because the Windows version of the
SalData constructor in vcl calls CoInitialize() (which sets the
concurrency model of the main thread to STA) and then later the
OleComponent constructor in embeddedobj calls OleInitialize(), which
just realizes that the concurrency model is already set, and OLE editing
works.
However, if the document is loaded on a thread, things are different.
The concurrency model of the thread is set to MTA in
oslWorkerWrapperFunction() in sal, so the later OleInitialize() will
fail with RPC_E_CHANGED_MODE, as it's not possible to set the
concurrency model of a thread once it's set.
Solve the problem by providing in opt-in way to execute the actual
import on the main thread, since remote UNO clients always invoke
Desktop::loadComponentFromURL() on a thread.
Reviewed-on: https://gerrit.libreoffice.org/65453
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit 2dc3a6c273cb82506842864481d78df7294debbf)
Conflicts:
framework/source/services/frame.cxx
Change-Id: I94f2721b599c3ae3e2ebc1c90dea649a69d51ef7
-rw-r--r-- | framework/source/services/frame.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index f3209b346544..0da8c99d0607 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -20,6 +20,8 @@ #include <services/frame.hxx> #include <dispatch/dispatchprovider.hxx> +#include <boost/bind.hpp> + #include <dispatch/interceptionhelper.hxx> #include <dispatch/closedispatcher.hxx> #include <dispatch/windowcommanddispatch.hxx> @@ -82,7 +84,9 @@ #include <comphelper/processfactory.hxx> #include <unotools/moduleoptions.hxx> #include <tools/diagnose_ex.h> +#include <unotools/cmdoptions.hxx> +#include <vcl/threadex.hxx> #include <vcl/menu.hxx> namespace framework{ @@ -320,7 +324,10 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromUR css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); - return LoadEnv::loadComponentFromURL(xThis, xContext, sURL, sTargetFrameName, nSearchFlags, lArguments); + return vcl::solarthread::syncExecute( + boost::bind(&LoadEnv::loadComponentFromURL, xThis, + xContext, sURL, sTargetFrameName, + nSearchFlags, lArguments)); } /*-****************************************************************************************************//** |