From c9aca4f728cee31078bd156089e91b0bae64e8e8 Mon Sep 17 00:00:00 2001 From: donghualin Date: Mon, 26 Sep 2022 02:58:42 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dwayland=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=97=B6=E5=B0=9A=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=89=93?= =?UTF-8?q?=E5=BC=80=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wayland下时尚模式的xcb_connection_t的值为nullptr,构造函数中传入一个可用的值 Log: 修复wayland环境时尚模式下打开企业微信崩溃的问题 Influence: 进入wayland桌面,进入时尚模式,打开企业微信,双击,观察企业微信是否正常打开 Task: https://pms.uniontech.com/task-view-196629.html Change-Id: Ib0a5ebdadbce672474db9dab57f27da263b8096b --- frame/window/tray/tray_delegate.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frame/window/tray/tray_delegate.cpp b/frame/window/tray/tray_delegate.cpp index dd6c65b79..c3122e1b7 100644 --- a/frame/window/tray/tray_delegate.cpp +++ b/frame/window/tray/tray_delegate.cpp @@ -64,14 +64,13 @@ QWidget *TrayDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem BaseTrayWidget *trayWidget = nullptr; if(type == TrayIconType::XEMBED) { if (Utils::IS_WAYLAND_DISPLAY) { - trayWidget = new XEmbedTrayItemWidget(winId, nullptr, nullptr, parent); - } else { - int screenp = 0; + static Display *display = XOpenDisplay(nullptr); + static int screenp = 0; static xcb_connection_t *xcb_connection = xcb_connect(qgetenv("DISPLAY"), &screenp); - static Display *m_display = XOpenDisplay(nullptr); - trayWidget = new XEmbedTrayItemWidget(winId, xcb_connection, m_display, parent); + trayWidget = new XEmbedTrayItemWidget(winId, xcb_connection, display, parent); + } else { + trayWidget = new XEmbedTrayItemWidget(winId, nullptr, nullptr, parent); } - const TrayModel *model = qobject_cast(index.model()); if (model) connect(model, &TrayModel::requestUpdateIcon, trayWidget, &BaseTrayWidget::updateIcon);