summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-08-26 13:49:13 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2021-08-26 17:58:03 +0200
commit923b30aa27ceb377d6a540c012000e89ce5db31e (patch)
treec93ec302baf058f34319c394237a15b6bc903158 /vcl/qt5
parentf72013ca65c7a33991d5fb124b919fe7cde269e2 (diff)
tdf#144008 Qt5/Kf5 create frames in the GUI thread
There was a 50% chance my pick would have been correct... ok, just half-true, as in hindsight, I should have preferred the secure variant using RunInMain to start with. I thought I could use some templated class functions to get rid of all the copy and paste, but that looked even more ugly. P.S. if you wonder - like myself - about the code formatting in Qt5Instance::CreateFrame: that if from clang-format. Change-Id: I3a6b0c12c9d71ad8e777ed82526d1515a249832c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121091 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/Qt5Instance.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 432af5e6f718..f1e34d2761b1 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -285,13 +285,21 @@ void Qt5Instance::deleteObjectLater(QObject* pObject) { pObject->deleteLater();
SalFrame* Qt5Instance::CreateChildFrame(SystemParentData* /*pParent*/, SalFrameStyleFlags nStyle)
{
- return new Qt5Frame(nullptr, nStyle, m_bUseCairo);
+ SalFrame* pRet(nullptr);
+ RunInMainThread([&, this]() { pRet = new Qt5Frame(nullptr, nStyle, useCairo()); });
+ assert(pRet);
+ return pRet;
}
SalFrame* Qt5Instance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle)
{
assert(!pParent || dynamic_cast<Qt5Frame*>(pParent));
- return new Qt5Frame(static_cast<Qt5Frame*>(pParent), nStyle, m_bUseCairo);
+
+ SalFrame* pRet(nullptr);
+ RunInMainThread(
+ [&, this]() { pRet = new Qt5Frame(static_cast<Qt5Frame*>(pParent), nStyle, useCairo()); });
+ assert(pRet);
+ return pRet;
}
void Qt5Instance::DestroyFrame(SalFrame* pFrame)
@@ -306,7 +314,11 @@ void Qt5Instance::DestroyFrame(SalFrame* pFrame)
SalObject* Qt5Instance::CreateObject(SalFrame* pParent, SystemWindowData*, bool bShow)
{
assert(!pParent || dynamic_cast<Qt5Frame*>(pParent));
- return new Qt5Object(static_cast<Qt5Frame*>(pParent), bShow);
+
+ SalObject* pRet(nullptr);
+ RunInMainThread([&]() { pRet = new Qt5Object(static_cast<Qt5Frame*>(pParent), bShow); });
+ assert(pRet);
+ return pRet;
}
void Qt5Instance::DestroyObject(SalObject* pObject)