diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-19 08:57:41 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-19 15:36:08 +0200 |
commit | b87df743b5d987e607c769e3c8f52cd3034dcaa8 (patch) | |
tree | 64f56e764899b53895c69104ddb1ce61c77595b8 /vcl | |
parent | 8ae911e1d98029e17e6ffb1d336fbfa7e5ea9ed4 (diff) |
qt: Run whole QtFrame::Show in main thread
Instead of running only parts of the method
explicitly in the main thread, ensure this
for the whole method.
Also, add a SolarMutexGuard at the beginning.
Change-Id: I9c510b2d58ee5a3b05c1a16ce8e53077c7075caa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173655
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/QtFrame.cxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 7723967c1537..fb3c5b66b0de 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -410,32 +410,36 @@ void QtFrame::SetExtendedFrameStyle(SalExtStyle /*nExtStyle*/) { /* not needed * void QtFrame::Show(bool bVisible, bool bNoActivate) { + SolarMutexGuard g; + QtInstance* pQtInstance = GetQtInstance(); + assert(pQtInstance); + if (!pQtInstance->IsMainThread()) + { + pQtInstance->RunInMainThread([&] { Show(bVisible, bNoActivate); }); + return; + } + assert(m_pQWidget); if (bVisible == asChild()->isVisible()) return; - auto* pSalInst(GetQtInstance()); - assert(pSalInst); - if (!bVisible) // hide { - pSalInst->RunInMainThread([this]() { asChild()->setVisible(false); }); + asChild()->setVisible(false); return; } // show SetDefaultSize(); - pSalInst->RunInMainThread([this, bNoActivate]() { - QWidget* const pChild = asChild(); - pChild->setVisible(true); - pChild->raise(); - if (!bNoActivate) - { - pChild->activateWindow(); - pChild->setFocus(); - } - }); + QWidget* const pChild = asChild(); + pChild->setVisible(true); + pChild->raise(); + if (!bNoActivate) + { + pChild->activateWindow(); + pChild->setFocus(); + } } void QtFrame::SetMinClientSize(tools::Long nWidth, tools::Long nHeight) |