diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-08-31 17:18:59 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-09-03 16:12:42 +0200 |
commit | 1178a5d8a6ae65c9336c71f481e19505d901227a (patch) | |
tree | 20cb1d7d30b4c37448030956c1f15298d8bed9c5 | |
parent | d8b550deae18c3c13aa8abb0dc4878a00f832515 (diff) |
sfx2: allow storeAsURL() on the main thread
This is similar to commit b030e83fccbff8d82a4c84462075baa8442cde54
(sfx2: allow storeToURL() on the main thread, 2019-02-05), just this
handles the 'export' case, not the 'save as' one.
Note that this already worked in some cases when impl_store() decided to
call storeSelf(), but vcl::solarthread::syncExecute() already avoids
dispatch when called on a non-main thread, so that is not a problem.
Change-Id: Ief09ba6c60923c7f16d86f61625c0faa9a5f829b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121385
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit 5d0860ed0600904a03459e8bf5a6792c671463a4)
(cherry picked from commit 1e7a4b148a384a408662015da7fc701a24917a2f)
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 533650751d75..adcea5aaf752 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1680,7 +1680,16 @@ void SAL_CALL SfxBaseModel::storeAsURL( const OUString& rURL SfxSaveGuard aSaveGuard(this, m_pData.get()); - impl_store( rURL, rArgs, false ); + utl::MediaDescriptor aDescriptor(rArgs); + bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault("OnMainThread", false); + if (bOnMainThread) + { + vcl::solarthread::syncExecute([this, rURL, rArgs]() { impl_store(rURL, rArgs, false); }); + } + else + { + impl_store(rURL, rArgs, false); + } Sequence< beans::PropertyValue > aSequence ; TransformItems( SID_OPENDOC, *m_pData->m_pObjectShell->GetMedium()->GetItemSet(), aSequence ); |