From 7d1130337b97556ce81f1b9ea1922ed12a6d5bda Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 9 Jul 2020 12:12:05 +0000 Subject: [PATCH] use static stops list in QGradient::stops() Signed-off-by: Ivailo Monev --- src/gui/painting/qbrush.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 8f487b287..78dc81b88 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1323,9 +1323,10 @@ void QGradient::setStops(const QGradientStops &stops) QGradientStops QGradient::stops() const { if (m_stops.isEmpty()) { - QGradientStops tmp; - tmp << QGradientStop(0, Qt::black) << QGradientStop(1, Qt::white); - return tmp; + static const QGradientStops stops = QGradientStops() + << QGradientStop(0, Qt::black) + << QGradientStop(1, Qt::white); + return stops; } return m_stops; }