summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/source/services/desktop.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 998f0af29a62..91611d4eaa45 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -57,6 +57,7 @@
#include <vcl/scheduler.hxx>
#include <sal/log.hxx>
#include <vcl/errcode.hxx>
+#include <vcl/threadex.hxx>
#include <unotools/configmgr.hxx>
namespace framework{
@@ -623,7 +624,25 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::loadComponentFrom
css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY);
- return LoadEnv::loadComponentFromURL(xThis, m_xContext, sURL, sTargetFrameName, nSearchFlags, lArguments);
+ utl::MediaDescriptor aDescriptor(lArguments);
+ 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
+ // another thread, leading to an std::abort() at the end.
+ SolarMutexGuard g;
+
+ return vcl::solarthread::syncExecute(std::bind(&LoadEnv::loadComponentFromURL, xThis,
+ m_xContext, sURL, sTargetFrameName,
+ nSearchFlags, lArguments));
+ }
+ else
+ {
+ return LoadEnv::loadComponentFromURL(xThis, m_xContext, sURL, sTargetFrameName,
+ nSearchFlags, lArguments);
+ }
}
/*-************************************************************************************************************