summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embeddedobj/source/msole/olecomponent.cxx8
-rw-r--r--sfx2/source/control/unoctitm.cxx21
2 files changed, 27 insertions, 2 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();
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 0a98f806d708..bc07f2af71d3 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -78,6 +78,8 @@
#include <comphelper/lok.hxx>
#include <desktop/crashreport.hxx>
+#include <vcl/threadex.hxx>
+#include <unotools/mediadescriptor.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -233,7 +235,24 @@ void SAL_CALL SfxOfficeDispatch::dispatch( const css::util::URL& aURL, const css
#if HAVE_FEATURE_JAVA
std::unique_ptr< css::uno::ContextLayer > layer(EnsureJavaContext());
#endif
- pImpl->dispatch( aURL, aArgs, css::uno::Reference < css::frame::XDispatchResultListener >() );
+ utl::MediaDescriptor aDescriptor(aArgs);
+ bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault("OnMainThread", false);
+ if (bOnMainThread)
+ {
+ // Make sure that we own the solar mutex, otherwise later
+ // vcl::SolarThreadExecutor::execute() will release the solar mutex, even if it's owned by
+ // an other thread, leading to an std::abort() at the end.
+ SolarMutexGuard aGuard;
+ vcl::solarthread::syncExecute([this, &aURL, &aArgs]() {
+ pImpl->dispatch(aURL, aArgs,
+ css::uno::Reference<css::frame::XDispatchResultListener>());
+ });
+ }
+ else
+ {
+ pImpl->dispatch(aURL, aArgs,
+ css::uno::Reference<css::frame::XDispatchResultListener>());
+ }
}
}