Skip to content

Commit b6528c4

Browse files
tsic404deepin-bot[bot]
authored andcommitted
fix: protocol error caused by frequent creation and destruction of WaylandOutput.
Use a Timer to delay the destruction of WaylandOutpt to avoid frequent creation and destruction of WaylandOutput causing protocol errors log: as title pms: BUG-292367
1 parent c7161e1 commit b6528c4

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

panels/dock/tray/SurfacePopup.qml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,18 @@ Item {
7272
menu.close()
7373
}
7474
}
75+
76+
onMenuVisibleChanged: {
77+
if (menuVisible) {
78+
subMenuLoader.active = true
79+
} else {
80+
subMenuLoaderDelayTimer.start()
81+
}
82+
}
83+
7584
Loader {
76-
active: menu.menuVisible
85+
id: subMenuLoader
86+
active: false
7787
sourceComponent: SurfaceSubPopup {
7888
objectName: "stashed's subPopup"
7989
transientParent: menuWindow
@@ -83,6 +93,17 @@ Item {
8393
return true
8494
}
8595
}
96+
97+
// Avoid protocol errors caused by d
98+
Timer {
99+
id: subMenuLoaderDelayTimer
100+
interval: 1000
101+
repeat: false
102+
running: false
103+
onTriggered: function () {
104+
subMenuLoader.active = false
105+
}
106+
}
86107
}
87108
}
88109

panels/dock/tray/TrayItemSurfacePopup.qml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ Item {
5555
menuX: DockPositioner.x
5656
menuY: DockPositioner.y
5757

58+
onMenuVisibleChanged: {
59+
if (menuVisible) {
60+
subMenuLoader.active = true
61+
} else {
62+
subMenuLoaderDelayTimer.start()
63+
}
64+
}
65+
5866
Item {
5967
anchors.fill: parent
6068
ShellSurfaceItemProxy {
@@ -65,8 +73,20 @@ Item {
6573
popupMenu.close()
6674
}
6775
}
76+
77+
// Avoid protocol errors caused by frequent creation and destruction of WaylandOutput.
78+
Timer {
79+
id: subMenuLoaderDelayTimer
80+
interval: 1000
81+
repeat: false
82+
running: false
83+
onTriggered: function () {
84+
subMenuLoader.active = false
85+
}
86+
}
6887
Loader {
69-
active: popupMenu.menuVisible
88+
id: subMenuLoader
89+
active: false
7090
sourceComponent: SurfaceSubPopup {
7191
objectName: "tray's subPopup"
7292
transientParent: popupMenu.menuWindow

0 commit comments

Comments
 (0)