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>
This commit is contained in:
Eirik Aavitsland 2019-09-11 11:46:47 +02:00
parent 51f1428d3c
commit b8a911fbeb

View File

@ -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;