Gui: Fix Gesture style context menu segfault

(cherry picked from commit dec0ea238a)
This commit is contained in:
Bas Ruigrok
2025-11-25 08:42:30 +01:00
committed by Max Wilfinger
parent 70c69bbebc
commit 30e94d0b3f
+23 -14
View File
@@ -2149,22 +2149,31 @@ void NavigationStyle::openPopupMenu(const SbVec2s& position)
contextMenu->insertSeparator(posAction);
}
QAction* selectedAction = contextMenu->exec(QCursor::pos());
QObject::connect(
contextMenu,
&QMenu::triggered,
contextMenu,
[this, navMenuGroup, pickAction](QAction* selectedAction) {
// handle navigation style change if user selected a navigation style option
if (selectedAction && isNavigationStyleAction(selectedAction, navMenuGroup)) {
applyNavigationStyleChange(selectedAction);
rightClickPosition.reset();
return;
}
// handle navigation style change if user selected a navigation style option
if (selectedAction && isNavigationStyleAction(selectedAction, navMenuGroup)) {
applyNavigationStyleChange(selectedAction);
rightClickPosition.reset();
return;
}
if (pickAction && selectedAction == pickAction) {
// Execute the Clarify Selection command at this position
auto cmd = Application::Instance->commandManager().getCommandByName("Std_ClarifySelection");
if (cmd && cmd->isActive()) {
cmd->invoke(0); // required placeholder value - we don't use group command
if (pickAction && selectedAction == pickAction) {
// Execute the Clarify Selection command at this position
auto cmd = Application::Instance->commandManager().getCommandByName(
"Std_ClarifySelection"
);
if (cmd && cmd->isActive()) {
cmd->invoke(0); // required placeholder value - we don't use group command
}
}
}
}
);
contextMenu->popup(QCursor::pos());
rightClickPosition.reset();
}