diff options
Diffstat (limited to 'vcl/qt5/Qt5Menu.cxx')
-rw-r--r-- | vcl/qt5/Qt5Menu.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx index 17578ef4ce24..5005755e574b 100644 --- a/vcl/qt5/Qt5Menu.cxx +++ b/vcl/qt5/Qt5Menu.cxx @@ -24,6 +24,7 @@ Qt5Menu::Qt5Menu(bool bMenuBar) , mpFrame(nullptr) , mbMenuBar(bMenuBar) { + connect(this, &Qt5Menu::setFrameSignal, this, &Qt5Menu::SetFrame, Qt::BlockingQueuedConnection); } Qt5Menu::~Qt5Menu() { maItems.clear(); } @@ -64,6 +65,12 @@ void Qt5Menu::SetSubMenu(SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned) void Qt5Menu::SetFrame(const SalFrame* pFrame) { + if (qApp->thread() != QThread::currentThread()) + { + SolarMutexReleaser aReleaser; + return Q_EMIT setFrameSignal(pFrame); + } + SolarMutexGuard aGuard; assert(mbMenuBar); mpFrame = const_cast<Qt5Frame*>(static_cast<const Qt5Frame*>(pFrame)); @@ -72,9 +79,11 @@ void Qt5Menu::SetFrame(const SalFrame* pFrame) Qt5MainWindow* pMainWindow = mpFrame->GetTopLevelWindow(); if (pMainWindow) + { mpQMenuBar = pMainWindow->menuBar(); - DoFullMenuUpdate(mpVCLMenu); + DoFullMenuUpdate(mpVCLMenu); + } } void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu) |