Icon engines: don't paint on a null-pixmap
If the pixmap created is null (perhaps because the size is null), then don't paint into it. It might crash as we might end up with an invalid device context. Task-number: QTBUG-127085 Pick-to: 6.7 Change-Id: I03b3beabe02f150a2970013c15842369d3a27596 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit b2b4bc2f2fb5de53e262c88023f278f782b80de5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
fbbcd87039
commit
4fe0e5dbc4
@ -408,9 +408,11 @@ QPixmap QAppleIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIco
|
||||
m_pixmap.setDevicePixelRatio(scale);
|
||||
m_pixmap.fill(Qt::transparent);
|
||||
|
||||
if (!m_pixmap.isNull()) {
|
||||
QPainter painter(&m_pixmap);
|
||||
paint(&painter, QRect(paintOffset.width(), paintOffset.height(),
|
||||
paintSize.width(), paintSize.height()), mode, state);
|
||||
}
|
||||
|
||||
m_cacheKey = cacheKey;
|
||||
}
|
||||
|
@ -572,8 +572,10 @@ QPixmap QAndroidPlatformIconEngine::scaledPixmap(const QSize &size, QIcon::Mode
|
||||
m_pixmap.fill(Qt::transparent);
|
||||
m_pixmap.setDevicePixelRatio(scale);
|
||||
|
||||
if (!m_pixmap.isNull()) {
|
||||
QPainter painter(&m_pixmap);
|
||||
paint(&painter, QRect(QPoint(), size), mode, state);
|
||||
}
|
||||
|
||||
m_cacheKey = cacheKey;
|
||||
}
|
||||
|
@ -353,8 +353,10 @@ QPixmap QWindowsIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QI
|
||||
m_pixmap.fill(Qt::transparent);
|
||||
m_pixmap.setDevicePixelRatio(scale);
|
||||
|
||||
if (!m_pixmap.isNull()) {
|
||||
QPainter painter(&m_pixmap);
|
||||
paint(&painter, QRect(QPoint(), size), mode, state);
|
||||
}
|
||||
|
||||
m_cacheKey = cacheKey;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user