mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
Address shutdown crash
This commit is contained in:
parent
8e8e23452f
commit
b63e4b9d1f
1 changed files with 9 additions and 2 deletions
|
@ -124,18 +124,25 @@ void VrMenu::addMenu(QMenu* menu) {
|
||||||
new MenuUserData(menu, result);
|
new MenuUserData(menu, result);
|
||||||
auto menuAction = menu->menuAction();
|
auto menuAction = menu->menuAction();
|
||||||
updateQmlItemFromAction(result, menuAction);
|
updateQmlItemFromAction(result, menuAction);
|
||||||
QObject::connect(menuAction, &QAction::changed, [=] {
|
auto connection = QObject::connect(menuAction, &QAction::changed, [=] {
|
||||||
updateQmlItemFromAction(result, menuAction);
|
updateQmlItemFromAction(result, menuAction);
|
||||||
});
|
});
|
||||||
|
QObject::connect(qApp, &QCoreApplication::aboutToQuit, [=] {
|
||||||
|
QObject::disconnect(connection);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bindActionToQmlAction(QObject* qmlAction, QAction* action) {
|
void bindActionToQmlAction(QObject* qmlAction, QAction* action) {
|
||||||
new MenuUserData(action, qmlAction);
|
new MenuUserData(action, qmlAction);
|
||||||
updateQmlItemFromAction(qmlAction, action);
|
updateQmlItemFromAction(qmlAction, action);
|
||||||
QObject::connect(action, &QAction::changed, [=] {
|
auto connection = QObject::connect(action, &QAction::changed, [=] {
|
||||||
updateQmlItemFromAction(qmlAction, action);
|
updateQmlItemFromAction(qmlAction, action);
|
||||||
});
|
});
|
||||||
|
QObject::connect(qApp, &QCoreApplication::aboutToQuit, [=] {
|
||||||
|
QObject::disconnect(connection);
|
||||||
|
});
|
||||||
|
|
||||||
QObject::connect(action, &QAction::toggled, [=](bool checked) {
|
QObject::connect(action, &QAction::toggled, [=](bool checked) {
|
||||||
qmlAction->setProperty("checked", checked);
|
qmlAction->setProperty("checked", checked);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue