[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
wilder-5.26
David Edmundson 4 years ago
parent c000092088
commit 449ae169d8
  1. 6
      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());

Loading…
Cancel
Save