Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions panels/dock/taskmanager/dockglobalelementmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ void DockGlobalElementModel::requestNewInstance(const QModelIndex &index, const
{
auto data = m_data.value(index.row());
auto id = std::get<0>(data);
auto sourceModel = std::get<1>(data);
auto sourceRow = std::get<2>(data);
qDebug(dockGlobalElementModelLog) << "Requesting new instance for index:" << index << "with action:" << action << "id:" << id;

// Handle special actions first (for both active and docked apps)
if (action == DOCK_ACTION_DOCK) {
Expand All @@ -417,29 +416,11 @@ void DockGlobalElementModel::requestNewInstance(const QModelIndex &index, const
} else if (action == DOCK_ACTION_CLOSEWINDOW || action == DOCK_ACTION_CLOSEALL) {
requestClose(index, false);
return;
}

//应用自身处理的action
if (!action.isEmpty()) {
} else {
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);
process.start("dde-am", {"--by-user", id, action});
process.waitForFinished();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Synchronous waitForFinished() now potentially blocks the UI for common actions.

Previously, waitForFinished() only ran for non-empty actions; now it also runs for the default (empty) action, which is likely the most common path. This can block the UI thread until dde-am exits. Consider making this call asynchronous (e.g., use signals instead of waitForFinished()) or restrict the synchronous wait to non-interactive or rare actions.

return;
}

// Handle launch/activate (empty action)
if (sourceModel == m_activeAppModel) {
auto sourceIndex = sourceModel->index(sourceRow, 0);
m_activeAppModel->requestNewInstance(sourceIndex, action);
} else {
QString dbusPath = QStringLiteral("/org/desktopspec/ApplicationManager1/") + escapeToObjectPath(id);
using Application = org::desktopspec::ApplicationManager1::Application;
Application appInterface(QStringLiteral("org.desktopspec.ApplicationManager1"), dbusPath, QDBusConnection::sessionBus());

if (appInterface.isValid()) {
appInterface.Launch(QString(), QStringList(), QVariantMap());
}
}
}

Expand Down