summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-07-14 10:32:46 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-07-14 11:52:00 +0200
commit19d473da14ac877cb0721063c7b18e16cb6f2b76 (patch)
treeac94142829df1dc22303ef02f6bac7d76334a50c /embeddedobj
parent686b2d70fe6361835a9c549ca13ecf0837b82296 (diff)
sfx2: handle OnMainThread=true in SfxOfficeDispatch::dispatch()
This is needed when an out of process Java UNO client registers their command dispatch interceptor, Windows OleInitialize() has been called already on the main thread and then dispatching e.g. uno:Paste (which would interact with OLE) would call OLE functions on a thread, which would fail with RPC_E_CHANGED_MODE. In other words, a situation similar to commit 22aa6508e0a65e65a6f9410b498fe4fd6c236639 (framework: allow dispatching a command on the main thread, 2019-01-29), but that one was for DispatchHelper, this one is for XDispatch implementations. Change-Id: If5a80fe36962e014e781d2a8c156055f127e69a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118886 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/msole/olecomponent.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index cbcc1f6e79d7..b0c4fc62c1ac 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -35,6 +35,7 @@
#include <cppuhelper/interfacecontainer.h>
#include <comphelper/mimeconfighelper.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/windowserrorstring.hxx>
#include <osl/file.hxx>
#include <rtl/ref.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
@@ -445,9 +446,14 @@ OleComponent::OleComponent( const uno::Reference< uno::XComponentContext >& xCon
OSL_ENSURE( m_pUnoOleObject, "No owner object is provided!" );
HRESULT hr = OleInitialize( nullptr );
- OSL_ENSURE( hr == S_OK || hr == S_FALSE, "The ole can not be successfully initialized" );
if ( hr == S_OK || hr == S_FALSE )
m_bOleInitialized = true;
+ else
+ {
+ SAL_WARN("embeddedobj.ole", "OleComponent ctor: OleInitialize() failed with 0x"
+ << OUString::number(static_cast<sal_uInt32>(hr), 16) << ": "
+ << WindowsErrorStringFromHRESULT(hr));
+ }
m_pOleWrapClientSite = new OleWrapperClientSite( this );
m_pOleWrapClientSite->AddRef();