summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainter.cpp
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2019-09-11 11:46:47 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2019-09-20 13:01:14 +0200
commitb8a911fbebfcd297ce08b91fbe85bb1624d257d9 (patch)
tree3d9a94d36976b7dc063a4386fdec7c1910105fa9 /src/gui/painting/qpainter.cpp
parent51f1428d3cd782c22226b0ee4bd7145a45762d86 (diff)
QPainter: Avoid leaking memory on unbalanced save/restore
If a QPainter ended without all saved states having been restored, the state stack would leak memory. Fixes: QTBUG-77843 Change-Id: I760904d6391de24a4867be54fa1bebf76be14ba7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r--src/gui/painting/qpainter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 95e6bda78b..f9e9563f10 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1710,8 +1710,8 @@ void QPainter::restore()
static inline void qt_cleanup_painter_state(QPainterPrivate *d)
{
+ qDeleteAll(d->states);
d->states.clear();
- delete d->state;
d->state = 0;
d->engine = 0;
d->device = 0;