From 449ae169d823c24601625cc9c2f3e4e838da7fe3 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 29 Jul 2022 12:35:07 +0000 Subject: [PATCH] [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 --- shell/panelview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/panelview.cpp b/shell/panelview.cpp index 9b319baec..173cd601b 100644 --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -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());