summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2018-12-05 14:25:08 +0200
committerTomi Korpipää <tomi.korpipaa@qt.io>2018-12-05 15:10:55 +0000
commitfe7d761863dc6f0da20319ddccd38ae3016ed2c3 (patch)
tree8a11767a54afdbd2a7dedee566b8aa59352d8071
parent0262d7cf8de1ae21ca80cb9ebbae8d975e7d4b8d (diff)
Fix crash on macOS when using menu during startup dialog
Task-number: QT3DS-2828 Change-Id: I5637d4b7acb3ea42bc872a4ef23e579d64ed1e15 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Studio/MainFrm.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp
index bc4b7727..1a152848 100644
--- a/src/Authoring/Studio/MainFrm.cpp
+++ b/src/Authoring/Studio/MainFrm.cpp
@@ -136,22 +136,26 @@ CMainFrame::CMainFrame()
connect(m_ui->actionPresentation_Settings, &QAction::triggered,
this, &CMainFrame::OnEditPresentationPreferences);
connect(m_ui->menu_Edit, &QMenu::aboutToShow, [this]() {
- QString type = g_StudioApp.getDuplicateType();
- QString label = tr("Duplicate %1").arg(type);
- m_ui->action_Duplicate_Object->setText(label);
- m_ui->action_Duplicate_Object->setEnabled(!type.isEmpty());
-
- type = g_StudioApp.getDeleteType();
- label = tr("Delete %1").arg(type);
- m_ui->actionDelete->setText(label);
- m_ui->actionDelete->setEnabled(!type.isEmpty());
-
- if (g_StudioApp.canUngroupSelectedObjects()) {
- m_ui->actionGroup->setText(tr("Ungroup Objects"));
- m_ui->actionGroup->setEnabled(true);
- } else {
- m_ui->actionGroup->setText(tr("Group Objects"));
- m_ui->actionGroup->setEnabled(g_StudioApp.canGroupSelectedObjects());
+ // macOS doesn't block menubar while startup dialog is being shown, and that causes a
+ // crash on aboutToShow if it's called before everything is set
+ if (m_ui->menu_Edit->isEnabled()) {
+ QString type = g_StudioApp.getDuplicateType();
+ QString label = tr("Duplicate %1").arg(type);
+ m_ui->action_Duplicate_Object->setText(label);
+ m_ui->action_Duplicate_Object->setEnabled(!type.isEmpty());
+
+ type = g_StudioApp.getDeleteType();
+ label = tr("Delete %1").arg(type);
+ m_ui->actionDelete->setText(label);
+ m_ui->actionDelete->setEnabled(!type.isEmpty());
+
+ if (g_StudioApp.canUngroupSelectedObjects()) {
+ m_ui->actionGroup->setText(tr("Ungroup Objects"));
+ m_ui->actionGroup->setEnabled(true);
+ } else {
+ m_ui->actionGroup->setText(tr("Group Objects"));
+ m_ui->actionGroup->setEnabled(g_StudioApp.canGroupSelectedObjects());
+ }
}
});
connect(m_ui->menu_Edit, &QMenu::aboutToHide, [this]() {