summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/image/qpixmap.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 558ae543c9..8133cc0a4d 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -947,6 +947,9 @@ bool QPixmap::doImageIO(QImageWriter *writer, int quality) const
/*!
Fills the pixmap with the given \a color.
+ The effect of this function is undefined when the pixmap is
+ being painted on.
+
\sa {QPixmap#Pixmap Transformations}{Pixmap Transformations}
*/
@@ -955,6 +958,13 @@ void QPixmap::fill(const QColor &color)
if (isNull())
return;
+ // Some people are probably already calling fill while a painter is active, so to not break
+ // their programs, only print a warning and return when the fill operation could cause a crash.
+ if (paintingActive() && (color.alpha() != 255) && !hasAlphaChannel()) {
+ qWarning("QPixmap::fill: Cannot fill while pixmap is being painted on");
+ return;
+ }
+
detach();
data->fill(color);
}