Skip to content

Commit b29f8d6

Browse files
authored
fix: tray plugin mouse right click cause dock crash (#352)
1.double screen and set extended mode 2.adjust dock height size 3.logout computer and then click the tray plugin right-click menu when the dock comes out Log: fix tray plugin mouse right click cause dock crash Issue: linuxdeepin/developer-center#8506 Influence: tray plugin menu display
1 parent c6138fc commit b29f8d6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

panels/dock/tray/frame/window/quickpluginwindow.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,10 +921,15 @@ void QuickDockItem::mousePressEvent(QMouseEvent *event)
921921
}
922922

923923
if (!m_contextMenu->actions().isEmpty()) {
924-
m_contextMenu->popup(QCursor::pos());
924+
QTimer::singleShot(0, this, [this]() {
925+
QMenu contextMenu(this);
926+
contextMenu.addActions(m_contextMenu->actions());
927+
contextMenu.exec(QCursor::pos());
928+
});
929+
930+
// Fixme: Can cause crash in some cases
931+
//m_contextMenu->popup(QCursor::pos());
925932
}
926-
927-
return QWidget::mousePressEvent(event);
928933
}
929934

930935
void QuickDockItem::enterEvent(QEnterEvent *event)

0 commit comments

Comments
 (0)