sfx2/source/doc/sfxbasemodel.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 1178a5d8a6ae65c9336c71f481e19505d901227a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Aug 31 17:18:59 2021 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Sep 3 16:12:42 2021 +0200

    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 <vmik...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 5d0860ed0600904a03459e8bf5a6792c671463a4)
    (cherry picked from commit 1e7a4b148a384a408662015da7fc701a24917a2f)

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 );

Reply via email to