Commit d01a5704 authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen 🌈
Browse files

Avoid a crash occurring when pushing the components a little hard

The situation described here occurs in particular when first increasing
the size of the component considerably, and then reducing it again
(such as switching to and from full screen in some application)
Error discovered in Peruse, but will happen elsewhere as well.
parent 8bcfc5d0
......@@ -318,7 +318,14 @@ void PageItem::paint(QPainter *painter)
m_intentionalDraw = false;
const int flags = PagePainter::Accessibility | PagePainter::Highlights | PagePainter::Annotations;
PagePainter::paintPageOnPainter(painter, m_page, observer, flags, width(), height(), QRect(QPoint(0,0), contentsSize()));
// Simply using the limits as described by contentsSize will, at times, result in the page painter
// attempting to write outside the data area, unsurprisingly resulting in a crash.
QRect limits(QPoint(0, 0), contentsSize());
if(limits.width() > width())
if(limits.height() > height())
PagePainter::paintPageOnPainter(painter, m_page, observer, flags, width(), height(), limits);
if (setAA) {
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