diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 11 | ||||
-rw-r--r-- | include/vcl/lok.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 10 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 6 |
4 files changed, 23 insertions, 5 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c6fe2d8c2636..7e0507c1d73c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2971,10 +2971,13 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma std::vector<beans::PropertyValue> aPropertyValuesVector(jsonToPropertyValuesVector(pArguments)); - beans::PropertyValue aSynchronMode; - aSynchronMode.Name = "SynchronMode"; - aSynchronMode.Value <<= false; - aPropertyValuesVector.push_back(aSynchronMode); + if (!vcl::lok::isUnipoll()) + { + beans::PropertyValue aSynchronMode; + aSynchronMode.Name = "SynchronMode"; + aSynchronMode.Value <<= false; + aPropertyValuesVector.push_back(aSynchronMode); + } int nView = SfxLokHelper::getView(); if (nView < 0) diff --git a/include/vcl/lok.hxx b/include/vcl/lok.hxx index 5c30b6290221..2dbc0443d7b7 100644 --- a/include/vcl/lok.hxx +++ b/include/vcl/lok.hxx @@ -18,6 +18,7 @@ namespace vcl { namespace lok { +bool VCL_DLLPUBLIC isUnipoll(); void VCL_DLLPUBLIC registerPollCallbacks(LibreOfficeKitPollCallback pPollCallback, LibreOfficeKitWakeCallback pWakeCallback, void* pData); } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 9e9b9ab53e82..a7828287205d 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -12,6 +12,7 @@ #include <com/sun/star/frame/Desktop.hpp> #include <comphelper/processfactory.hxx> +#include <vcl/lok.hxx> #include <vcl/svapp.hxx> #include <vcl/commandevent.hxx> #include <sfx2/app.hxx> @@ -313,7 +314,14 @@ namespace } pEvent->mnView = SfxLokHelper::getView(nullptr); - Application::PostUserEvent(Link<void*, void>(pEvent, LOKPostAsyncEvent)); + if (vcl::lok::isUnipoll()) + { + if (!Application::IsMainThread()) + SAL_WARN("lok", "Posting event directly but not called from main thread!"); + LOKPostAsyncEvent(pEvent, nullptr); + } + else + Application::PostUserEvent(Link<void*, void>(pEvent, LOKPostAsyncEvent)); } } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 0037d35443f9..df05d78d864f 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1675,6 +1675,12 @@ void registerPollCallbacks( } } +bool isUnipoll() +{ + ImplSVData * pSVData = ImplGetSVData(); + return pSVData && pSVData->mpPollClosure != nullptr; +} + } } // namespace lok, namespace vcl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |