diff --git a/src/plugins/coreplugin/locator/commandlocator.cpp b/src/plugins/coreplugin/locator/commandlocator.cpp index 2768dca3a3b..7546d0f9b06 100644 --- a/src/plugins/coreplugin/locator/commandlocator.cpp +++ b/src/plugins/coreplugin/locator/commandlocator.cpp @@ -31,6 +31,7 @@ #include #include +#include namespace Core { @@ -104,8 +105,11 @@ void CommandLocator::accept(LocatorFilterEntry entry, const int index = entry.internalData.toInt(); QTC_ASSERT(index >= 0 && index < d->commands.size(), return); QAction *action = d->commands.at(index)->action(); - QTC_ASSERT(action->isEnabled(), return); - action->trigger(); + // avoid nested stack trace and blocking locator by delayed triggering + QTimer::singleShot(0, action, [action] { + if (action->isEnabled()) + action->trigger(); + }); } void CommandLocator::refresh(QFutureInterface &) diff --git a/src/plugins/coreplugin/menubarfilter.cpp b/src/plugins/coreplugin/menubarfilter.cpp index 5c3c4414db8..3847a5b3828 100644 --- a/src/plugins/coreplugin/menubarfilter.cpp +++ b/src/plugins/coreplugin/menubarfilter.cpp @@ -37,6 +37,7 @@ #include #include #include +#include using namespace Core::Internal; using namespace Core; @@ -78,8 +79,12 @@ void MenuBarFilter::accept(LocatorFilterEntry selection, QString *newText, Q_UNUSED(newText); Q_UNUSED(selectionStart); Q_UNUSED(selectionLength); - if (auto action = selection.internalData.value>()) - action->trigger(); + if (auto action = selection.internalData.value>()) { + QTimer::singleShot(0, action, [action] { + if (action->isEnabled()) + action->trigger(); + }); + } } void MenuBarFilter::refresh(QFutureInterface &future)