Commit 449ae169 authored by David Edmundson's avatar David Edmundson
Browse files

[panelview] Avoid assert if max < min

Max and min are calculated from two completely different sources.

There's scope for them to not be the expected way round.

We have an assert reported on this line due to a subtle qBound ->
std::clamp porting difference on GCC with debug flags on.

BUG: 454064
parent c0000920
Pipeline #210284 passed with stage
in 11 minutes and 24 seconds
......@@ -618,13 +618,15 @@ void PanelView::resizePanel()
if (formFactor() == Plasma::Types::Vertical) {
const int minSize = qMax(MINSIZE, m_minLength);
const int maxSize = qMin(m_maxLength, m_screenToFollow->size().height() - m_offset);
int maxSize = qMin(m_maxLength, m_screenToFollow->size().height() - m_offset);
maxSize = qMax(minSize, maxSize);
targetMinSize = QSize(totalThickness(), minSize);
targetMaxSize = QSize(totalThickness(), maxSize);
targetSize = QSize(totalThickness(), std::clamp(m_contentLength, minSize, maxSize));
} else {
const int minSize = qMax(MINSIZE, m_minLength);
const int maxSize = qMin(m_maxLength, m_screenToFollow->size().width() - m_offset);
int maxSize = qMin(m_maxLength, m_screenToFollow->size().width() - m_offset);
maxSize = qMax(minSize, maxSize);
targetMinSize = QSize(minSize, totalThickness());
targetMaxSize = QSize(maxSize, totalThickness());
targetSize = QSize(std::clamp(m_contentLength, minSize, maxSize), totalThickness());
......
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