1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Limit height of image in PageScreen to prevent crash.

Closes #608
This commit is contained in:
nowrep 2013-01-22 11:45:45 +01:00
parent 54724ead2b
commit ab3c351e5a

View File

@ -33,6 +33,14 @@
#include <QtConcurrentRun> #include <QtConcurrentRun>
#endif #endif
static QSize limitSize(const QSize &originalSize)
{
if (originalSize.height() > 20000) {
return QSize(originalSize.width(), 20000);
}
return originalSize;
}
PageScreen::PageScreen(WebView* view, QWidget* parent) PageScreen::PageScreen(WebView* view, QWidget* parent)
: QDialog(parent) : QDialog(parent)
@ -77,7 +85,7 @@ void PageScreen::createThumbnail()
{ {
QWebPage* page = m_view->page(); QWebPage* page = m_view->page();
QSize originalSize = page->viewportSize(); QSize originalSize = page->viewportSize();
page->setViewportSize(page->mainFrame()->contentsSize()); page->setViewportSize(limitSize(page->mainFrame()->contentsSize()));
m_pageImage = QImage(page->viewportSize(), QImage::Format_ARGB32_Premultiplied); m_pageImage = QImage(page->viewportSize(), QImage::Format_ARGB32_Premultiplied);
QPainter painter(&m_pageImage); QPainter painter(&m_pageImage);