summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5Instance.cxx
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-11-01 13:57:56 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-11-12 23:04:54 +0100
commit927f58bd997b6c1b60e354ee247a119d3f0af64b (patch)
tree9340100b2051a547d73e559f6209accd06e46952 /vcl/qt5/Qt5Instance.cxx
parent8fb0881a3e5b2c5120af18823f6f58a1bda7cadd (diff)
tdf#119856: thread-proof creating frames and setting menus
This finally enables opening a new frame and setting its menu from an extension, but it is still far from stable, loads of threading landmines like this all over the code Change-Id: Icf4b67796b0669425ecb7c2c142c21e184024534 Reviewed-on: https://gerrit.libreoffice.org/62737 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'vcl/qt5/Qt5Instance.cxx')
-rw-r--r--vcl/qt5/Qt5Instance.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index f780860dccc5..8215b67b71ea 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -64,6 +64,8 @@ Qt5Instance::Qt5Instance(bool bUseCairo)
// is processed before the thread emitting the signal continues
connect(this, SIGNAL(ImplYieldSignal(bool, bool)), this, SLOT(ImplYield(bool, bool)),
Qt::BlockingQueuedConnection);
+ connect(this, &Qt5Instance::createMenuSignal, this, &Qt5Instance::CreateMenu,
+ Qt::BlockingQueuedConnection);
}
Qt5Instance::~Qt5Instance()
@@ -119,6 +121,12 @@ Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, D
std::unique_ptr<SalMenu> Qt5Instance::CreateMenu(bool bMenuBar, Menu* pVCLMenu)
{
+ if (qApp->thread() != QThread::currentThread())
+ {
+ SolarMutexReleaser aReleaser;
+ return Q_EMIT createMenuSignal(bMenuBar, pVCLMenu);
+ }
+
Qt5Menu* pSalMenu = new Qt5Menu(bMenuBar);
pSalMenu->SetMenu(pVCLMenu);
return std::unique_ptr<SalMenu>(pSalMenu);