From ba1f1af83e2542cc953a31e308fbf88c55be5a07 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 11 May 2017 19:29:57 +0300 Subject: [PATCH] Test QImage instead of QPixmap for render. Trying to fix a strange crash inside QWidget::render(). --- Telegram/SourceFiles/dialogswidget.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 666618370..99ad052f7 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -2387,10 +2387,11 @@ void DialogsWidget::startWidthAnimation() { auto grabGeometry = QRect(scrollGeometry.x(), scrollGeometry.y(), st::dialogsWidthMin, scrollGeometry.height()); _scroll->setGeometry(grabGeometry); myEnsureResized(_scroll); - _widthAnimationCache = QPixmap(grabGeometry.size() * cIntRetinaFactor()); - _widthAnimationCache.setDevicePixelRatio(cRetinaFactor()); - _widthAnimationCache.fill(Qt::transparent); - _scroll->render(&_widthAnimationCache, QPoint(0, 0), QRect(QPoint(0, 0), grabGeometry.size()), QWidget::DrawChildren | QWidget::IgnoreMask); + auto image = QImage(grabGeometry.size() * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); + image.setDevicePixelRatio(cRetinaFactor()); + image.fill(Qt::transparent); + _scroll->render(&image, QPoint(0, 0), QRect(QPoint(0, 0), grabGeometry.size()), QWidget::DrawChildren | QWidget::IgnoreMask); + _widthAnimationCache = App::pixmapFromImageInPlace(std::move(image)); _scroll->setGeometry(scrollGeometry); _scroll->hide(); }