diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 900114384f..0212b165d1 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -564,6 +564,12 @@ void BufferView::updateScrollbar() d->scrollbarParameters_.max -= minVisiblePart(); else d->scrollbarParameters_.max -= d->scrollbarParameters_.page_step; + + // 0 must be inside the range as it denotes the current position + if (d->scrollbarParameters_.max < 0) + d->scrollbarParameters_.max = 0; + if (d->scrollbarParameters_.min > 0) + d->scrollbarParameters_.min = 0; } diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 9223964e42..75afebfd02 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -671,10 +671,9 @@ void GuiWorkArea::toggleCursor() void GuiWorkArea::Private::updateScrollbar() { ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters(); - // WARNING: don't touch at the scrollbar value like this: - // verticalScrollBar()->setValue(scroll_.position); - // because this would cause a recursive signal/slot calling with - // GuiWorkArea::scrollTo + // Block signals to prevent setRange() and setSliderPosition from causing + // recursive calls via the signal valueChanged. (#10311) + QSignalBlocker blocker(p->verticalScrollBar()); p->verticalScrollBar()->setRange(scroll_.min, scroll_.max); p->verticalScrollBar()->setPageStep(scroll_.page_step); p->verticalScrollBar()->setSingleStep(scroll_.single_step);