Commit 22d9376c authored by Fushan Wen's avatar Fushan Wen Committed by Nate Graham
Browse files

applets/taskmanager: Workaround for QTBUG-102811

When the size of ScrollView depends on its delegate items and `reuseItems`
is set to true, the program is prone to crash.

Although delayed binding on `Layout.minimumWidth` mitigates the crash,
there are still some related crash reports.

This adds a workaround for QTBUG-102811 to fix the potential crash. To
reproduce the crash, open 20 Konsole windows and 2 windows of other
program, set `delayed: false` in `Binding on Layout.minimumWidth` in the
origin code, and move mouse between the two grouped tasks in the task
manager.

BUG: 452660
parent 9cc82e25
Pipeline #168405 passed with stage
in 4 minutes and 29 seconds
......@@ -95,26 +95,29 @@ Loader {
ListView {
id: groupToolTipListView
model: DelegateModel {
id: delegateModel
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-102811
model: delegateModel.count > 0 ? delegateModel : null
// On Wayland, a tooltip has a significant resizing process, so estimate the size first.
readonly property int estimatedWidth: (toolTipDelegate.isVerticalPanel ? 1 : count) * (toolTipDelegate.tooltipInstanceMaximumWidth + PlasmaCore.Units.largeSpacing) - PlasmaCore.Units.largeSpacing
readonly property int estimatedHeight: (toolTipDelegate.isVerticalPanel ? count : 1) * (toolTipDelegate.tooltipInstanceMaximumWidth / 2 + PlasmaCore.Units.largeSpacing) - PlasmaCore.Units.largeSpacing
orientation: isVerticalPanel ? ListView.Vertical : ListView.Horizontal
reuseItems: true
spacing: PlasmaCore.Units.largeSpacing
}
model: tasksModel
DelegateModel {
id: delegateModel
rootIndex: toolTipDelegate.rootIndex
onRootIndexChanged: groupToolTipListView.positionViewAtBeginning() // Fix a visual glitch (when the mouse moves from a tooltip with a moved scrollbar to another tooltip without a scrollbar)
// On Wayland, a tooltip has a significant resizing process, so estimate the size first.
readonly property int estimatedWidth: (toolTipDelegate.isVerticalPanel ? 1 : count) * (toolTipDelegate.tooltipInstanceMaximumWidth + PlasmaCore.Units.largeSpacing) - PlasmaCore.Units.largeSpacing
readonly property int estimatedHeight: (toolTipDelegate.isVerticalPanel ? count : 1) * (toolTipDelegate.tooltipInstanceMaximumWidth / 2 + PlasmaCore.Units.largeSpacing) - PlasmaCore.Units.largeSpacing
delegate: ToolTipInstance {
submodelIndex: tasksModel.makeModelIndex(toolTipDelegate.rootIndex.row, index)
}
}
model: tasksModel
orientation: isVerticalPanel ? ListView.Vertical : ListView.Horizontal
reuseItems: true
spacing: PlasmaCore.Units.largeSpacing
rootIndex: toolTipDelegate.rootIndex
onRootIndexChanged: groupToolTipListView.positionViewAtBeginning() // Fix a visual glitch (when the mouse moves from a tooltip with a moved scrollbar to another tooltip without a scrollbar)
delegate: ToolTipInstance {
submodelIndex: tasksModel.makeModelIndex(toolTipDelegate.rootIndex.row, index)
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment